CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/Validation/GlobalHits/src/GlobalHitsHistogrammer.cc

Go to the documentation of this file.
00001 
00010 #include "Validation/GlobalHits/interface/GlobalHitsHistogrammer.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012 
00013 GlobalHitsHistogrammer::GlobalHitsHistogrammer(const edm::ParameterSet& iPSet) 
00014   : fName(""), verbosity(0), frequency(0), vtxunit(0), label(""), 
00015   getAllProvenances(false), printProvenanceInfo(false), count(0)
00016 {
00017   std::string MsgLoggerCat = "GlobalHitsHistogrammer_GlobalHitsHistogrammer";
00018 
00019   // get information from parameter set
00020   fName = iPSet.getUntrackedParameter<std::string>("Name");
00021   verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
00022   frequency = iPSet.getUntrackedParameter<int>("Frequency");
00023   vtxunit = iPSet.getUntrackedParameter<int>("VtxUnit");
00024   outputfile = iPSet.getParameter<std::string>("OutputFile");
00025   doOutput = iPSet.getParameter<bool>("DoOutput");
00026   edm::ParameterSet m_Prov =
00027     iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
00028   getAllProvenances = 
00029     m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
00030   printProvenanceInfo = 
00031     m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
00032 
00033   //get Labels to use to extract information
00034   GlobalHitSrc_ = iPSet.getParameter<edm::InputTag>("GlobalHitSrc");
00035 
00036   // use value of first digit to determine default output level (inclusive)
00037   // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
00038   verbosity %= 10;
00039 
00040   // print out Parameter Set information being used
00041   if (verbosity >= 0) {
00042     edm::LogInfo(MsgLoggerCat) 
00043       << "\n===============================\n"
00044       << "Initialized as EDAnalyzer with parameter values:\n"
00045       << "    Name          = " << fName << "\n"
00046       << "    Verbosity     = " << verbosity << "\n"
00047       << "    Frequency     = " << frequency << "\n"
00048       << "    VtxUnit       = " << vtxunit << "\n"
00049       << "    OutputFile    = " << outputfile << "\n"
00050       << "    DoOutput      = " << doOutput << "\n"
00051       << "    GetProv       = " << getAllProvenances << "\n"
00052       << "    PrintProv     = " << printProvenanceInfo << "\n"
00053       << "    GlobalHitSrc  = " << GlobalHitSrc_.label() 
00054       << ":" << GlobalHitSrc_.instance() << "\n"
00055       << "===============================\n";
00056   }
00057 
00058   // get dqm info
00059   dbe = 0;
00060   dbe = edm::Service<DQMStore>().operator->();
00061   if (dbe) {
00062     if (verbosity > 0 ) {
00063       dbe->setVerbose(1);
00064     } else {
00065       dbe->setVerbose(0);
00066     }
00067   }
00068 
00069   if (dbe) {
00070     if (verbosity > 0 ) dbe->showDirStructure();
00071   }
00072 
00073   // initialize monitor elements
00074   for (Int_t i = 0; i < 2; ++i) {
00075     meMCRGP[i] = 0;
00076     meMCG4Vtx[i] = 0;
00077     meGeantVtxX[i] = 0;
00078     meGeantVtxY[i] = 0;
00079     meGeantVtxZ[i] = 0; 
00080     meMCG4Trk[i] = 0;
00081     meCaloEcal[i] = 0;
00082     meCaloEcalE[i] = 0;
00083     meCaloEcalToF[i] = 0;
00084     meCaloPreSh[i] = 0;
00085     meCaloPreShE[i] = 0;
00086     meCaloPreShToF[i] = 0;
00087     meCaloHcal[i] = 0;
00088     meCaloHcalE[i] = 0;
00089     meCaloHcalToF[i] = 0;
00090     meTrackerPx[i] = 0;
00091     meTrackerSi[i] = 0;
00092     meMuon[i] = 0;
00093     meMuonDtToF[i] = 0;
00094     meMuonCscToF[i] = 0;
00095     meMuonRpcFToF[i] = 0;
00096     meMuonRpcBToF[i] = 0;
00097   }
00098   meGeantTrkPt = 0;
00099   meGeantTrkE = 0;
00100   meCaloEcalPhi = 0;
00101   meCaloEcalEta = 0;
00102   meCaloPreShPhi = 0;
00103   meCaloPreShEta = 0;
00104   meCaloHcalPhi = 0;
00105   meCaloHcalEta = 0;
00106   meTrackerPxPhi = 0;
00107   meTrackerPxEta = 0;
00108   meTrackerPxBToF = 0;
00109   meTrackerPxBR = 0;
00110   meTrackerPxFToF = 0;
00111   meTrackerPxFZ = 0;
00112   meTrackerSiPhi = 0;
00113   meTrackerSiEta = 0;
00114   meTrackerSiBToF = 0;
00115   meTrackerSiBR = 0;
00116   meTrackerSiFToF = 0;
00117   meTrackerSiFZ = 0;
00118   meMuonPhi = 0;
00119   meMuonEta = 0;
00120   meMuonDtR = 0;
00121   meMuonCscZ = 0;
00122   meMuonRpcBR = 0;
00123   meMuonRpcFZ = 0;
00124 
00125   //create histograms
00126   Char_t hname[200];
00127   Char_t htitle[200];
00128   if (dbe) {
00129 
00130     // MCGeant
00131     dbe->setCurrentFolder("GlobalHitsV/MCGeant");
00132     sprintf(hname,"hMCRGP1");
00133     sprintf(htitle,"RawGenParticles");
00134     meMCRGP[0] = dbe->book1D(hname,htitle,100,0.,5000.);
00135     sprintf(hname,"hMCRGP2");
00136     meMCRGP[1] = dbe->book1D(hname,htitle,100,0.,500.);  
00137     for (Int_t i = 0; i < 2; ++i) {
00138       meMCRGP[i]->setAxisTitle("Number of Raw Generated Particles",1);
00139       meMCRGP[i]->setAxisTitle("Count",2);
00140     }
00141 
00142     sprintf(hname,"hMCG4Vtx1");
00143     sprintf(htitle,"G4 Vertices");
00144     meMCG4Vtx[0] = dbe->book1D(hname,htitle,100,0.,50000.);
00145     sprintf(hname,"hMCG4Vtx2");
00146     meMCG4Vtx[1] = dbe->book1D(hname,htitle,100,-0.5,99.5); 
00147     for (Int_t i = 0; i < 2; ++i) {
00148       meMCG4Vtx[i]->setAxisTitle("Number of Vertices",1);
00149       meMCG4Vtx[i]->setAxisTitle("Count",2);
00150     }
00151 
00152     sprintf(hname,"hMCG4Trk1");
00153     sprintf(htitle,"G4 Tracks");
00154     meMCG4Trk[0] = dbe->book1D(hname,htitle,150,0.,15000.);
00155     sprintf(hname,"hMCG4Trk2");
00156     meMCG4Trk[1] = dbe->book1D(hname,htitle,150,-0.5,99.5);    
00157     for (Int_t i = 0; i < 2; ++i) {
00158       meMCG4Trk[i]->setAxisTitle("Number of Tracks",1);
00159       meMCG4Trk[i]->setAxisTitle("Count",2);
00160     }
00161 
00162     sprintf(hname,"hGeantVtxX1");
00163     sprintf(htitle,"Geant vertex x/micrometer");
00164     meGeantVtxX[0] = dbe->book1D(hname,htitle,100,-8000000.,8000000.);
00165     sprintf(hname,"hGeantVtxX2");
00166     meGeantVtxX[1] = dbe->book1D(hname,htitle,100,-50.,50.); 
00167     for (Int_t i = 0; i < 2; ++i) {
00168       meGeantVtxX[i]->setAxisTitle("x of Vertex (um)",1);
00169       meGeantVtxX[i]->setAxisTitle("Count",2);
00170     }
00171 
00172     sprintf(hname,"hGeantVtxY1");
00173     sprintf(htitle,"Geant vertex y/micrometer");
00174     meGeantVtxY[0] = dbe->book1D(hname,htitle,100,-8000000,8000000.);
00175     sprintf(hname,"hGeantVtxY2");
00176     meGeantVtxY[1] = dbe->book1D(hname,htitle,100,-50.,50.); 
00177     for (Int_t i = 0; i < 2; ++i) {
00178       meGeantVtxY[i]->setAxisTitle("y of Vertex (um)",1);
00179       meGeantVtxY[i]->setAxisTitle("Count",2);
00180     }
00181 
00182     sprintf(hname,"hGeantVtxZ1");
00183     sprintf(htitle,"Geant vertex z/millimeter");
00184     meGeantVtxZ[0] = dbe->book1D(hname,htitle,100,-11000.,11000.);
00185     sprintf(hname,"hGeantVtxZ2");
00186     meGeantVtxZ[1] = dbe->book1D(hname,htitle,100,-250.,250.);
00187     for (Int_t i = 0; i < 2; ++i) {
00188       meGeantVtxZ[i]->setAxisTitle("z of Vertex (mm)",1);
00189       meGeantVtxZ[i]->setAxisTitle("Count",2);
00190     }
00191 
00192     sprintf(hname,"hGeantTrkPt");
00193     sprintf(htitle,"Geant track pt/GeV");
00194     meGeantTrkPt = dbe->book1D(hname,htitle,100,0.,200.);
00195     meGeantTrkPt->setAxisTitle("pT of Track (GeV)",1);
00196     meGeantTrkPt->setAxisTitle("Count",2);
00197 
00198     sprintf(hname,"hGeantTrkE");
00199     sprintf(htitle,"Geant track E/GeV");
00200     meGeantTrkE = dbe->book1D(hname,htitle,100,0.,5000.);
00201     meGeantTrkE->setAxisTitle("E of Track (GeV)",1);
00202     meGeantTrkE->setAxisTitle("Count",2);
00203 
00204     // ECal
00205     dbe->setCurrentFolder("GlobalHitsV/ECals");
00206     sprintf(hname,"hCaloEcal1");
00207     sprintf(htitle,"Ecal hits");
00208     meCaloEcal[0] = dbe->book1D(hname,htitle,100,0.,10000.);
00209     sprintf(hname,"hCaloEcal2");
00210     meCaloEcal[1] = dbe->book1D(hname,htitle,100,-0.5,99.5);
00211 
00212     sprintf(hname,"hCaloEcalE1");
00213     sprintf(htitle,"Ecal hits, energy/GeV");
00214     meCaloEcalE[0] = dbe->book1D(hname,htitle,100,0.,10.);
00215     sprintf(hname,"hCaloEcalE2");
00216     meCaloEcalE[1] = dbe->book1D(hname,htitle,100,0.,0.1);
00217 
00218     sprintf(hname,"hCaloEcalToF1");
00219     sprintf(htitle,"Ecal hits, ToF/ns");
00220     meCaloEcalToF[0] = dbe->book1D(hname,htitle,100,0.,1000.);
00221     sprintf(hname,"hCaloEcalToF2");
00222     meCaloEcalToF[1] = dbe->book1D(hname,htitle,100,0.,100.);
00223  
00224     for (Int_t i = 0; i < 2; ++i) {
00225       meCaloEcal[i]->setAxisTitle("Number of Hits",1);
00226       meCaloEcal[i]->setAxisTitle("Count",2);
00227       meCaloEcalE[i]->setAxisTitle("Energy of Hits (GeV)",1);
00228       meCaloEcalE[i]->setAxisTitle("Count",2);
00229       meCaloEcalToF[i]->setAxisTitle("Time of Flight of Hits (ns)",1);
00230       meCaloEcalToF[i]->setAxisTitle("Count",2);
00231     }
00232 
00233     sprintf(hname,"hCaloEcalPhi");
00234     sprintf(htitle,"Ecal hits, phi/rad");
00235     meCaloEcalPhi = dbe->book1D(hname,htitle,100,-3.2,3.2);
00236     meCaloEcalPhi->setAxisTitle("Phi of Hits (rad)",1);
00237     meCaloEcalPhi->setAxisTitle("Count",2);
00238 
00239     sprintf(hname,"hCaloEcalEta");
00240     sprintf(htitle,"Ecal hits, eta");
00241     meCaloEcalEta = dbe->book1D(hname,htitle,100,-5.5,5.5);
00242     meCaloEcalEta->setAxisTitle("Eta of Hits",1);
00243     meCaloEcalEta->setAxisTitle("Count",2);
00244 
00245     sprintf(hname,"hCaloPreSh1");
00246     sprintf(htitle,"PreSh hits");
00247     meCaloPreSh[0] = dbe->book1D(hname,htitle,100,0.,10000.);
00248     sprintf(hname,"hCaloPreSh2");
00249     meCaloPreSh[1] = dbe->book1D(hname,htitle,100,-0.5,99.5);
00250 
00251     sprintf(hname,"hCaloPreShE1");
00252     sprintf(htitle,"PreSh hits, energy/GeV");
00253     meCaloPreShE[0] = dbe->book1D(hname,htitle,100,0.,10.);
00254     sprintf(hname,"hCaloPreShE2");
00255     meCaloPreShE[1] = dbe->book1D(hname,htitle,100,0.,0.1);
00256 
00257     sprintf(hname,"hCaloPreShToF1");
00258     sprintf(htitle,"PreSh hits, ToF/ns");
00259     meCaloPreShToF[0] = dbe->book1D(hname,htitle,100,0.,1000.);
00260     sprintf(hname,"hCaloPreShToF2");
00261     meCaloPreShToF[1] = dbe->book1D(hname,htitle,100,0.,100.);
00262 
00263     for (Int_t i = 0; i < 2; ++i) {
00264       meCaloPreSh[i]->setAxisTitle("Number of Hits",1);
00265       meCaloPreSh[i]->setAxisTitle("Count",2);
00266       meCaloPreShE[i]->setAxisTitle("Energy of Hits (GeV)",1);
00267       meCaloPreShE[i]->setAxisTitle("Count",2);
00268       meCaloPreShToF[i]->setAxisTitle("Time of Flight of Hits (ns)",1);
00269       meCaloPreShToF[i]->setAxisTitle("Count",2);
00270     }
00271 
00272     sprintf(hname,"hCaloPreShPhi");
00273     sprintf(htitle,"PreSh hits, phi/rad");
00274     meCaloPreShPhi = dbe->book1D(hname,htitle,100,-3.2,3.2);
00275     meCaloPreShPhi->setAxisTitle("Phi of Hits (rad)",1);
00276     meCaloPreShPhi->setAxisTitle("Count",2);
00277 
00278     sprintf(hname,"hCaloPreShEta");
00279     sprintf(htitle,"PreSh hits, eta");
00280     meCaloPreShEta = dbe->book1D(hname,htitle,100,-5.5,5.5);
00281     meCaloPreShEta->setAxisTitle("Eta of Hits",1);
00282     meCaloPreShEta->setAxisTitle("Count",2);
00283 
00284     // Hcal
00285     dbe->setCurrentFolder("GlobalHitsV/HCals");
00286     sprintf(hname,"hCaloHcal1");
00287     sprintf(htitle,"Hcal hits");
00288     meCaloHcal[0] = dbe->book1D(hname,htitle,100,0.,10000.);
00289     sprintf(hname,"hCaloHcal2");
00290     meCaloHcal[1] = dbe->book1D(hname,htitle,100,-0.5,99.5);
00291 
00292     sprintf(hname,"hCaloHcalE1");
00293     sprintf(htitle,"Hcal hits, energy/GeV");
00294     meCaloHcalE[0] = dbe->book1D(hname,htitle,100,0.,10.);
00295     sprintf(hname,"hCaloHcalE2");
00296     meCaloHcalE[1] = dbe->book1D(hname,htitle,100,0.,0.1);
00297 
00298     sprintf(hname,"hCaloHcalToF1");
00299     sprintf(htitle,"Hcal hits, ToF/ns");
00300     meCaloHcalToF[0] = dbe->book1D(hname,htitle,100,0.,1000.);
00301     sprintf(hname,"hCaloHcalToF2");
00302     meCaloHcalToF[1] = dbe->book1D(hname,htitle,100,0.,100.);
00303 
00304     for (Int_t i = 0; i < 2; ++i) {
00305       meCaloHcal[i]->setAxisTitle("Number of Hits",1);
00306       meCaloHcal[i]->setAxisTitle("Count",2);
00307       meCaloHcalE[i]->setAxisTitle("Energy of Hits (GeV)",1);
00308       meCaloHcalE[i]->setAxisTitle("Count",2);
00309       meCaloHcalToF[i]->setAxisTitle("Time of Flight of Hits (ns)",1);
00310       meCaloHcalToF[i]->setAxisTitle("Count",2);
00311     }
00312 
00313     sprintf(hname,"hCaloHcalPhi");
00314     sprintf(htitle,"Hcal hits, phi/rad");
00315     meCaloHcalPhi = dbe->book1D(hname,htitle,100,-3.2,3.2);
00316     meCaloHcalPhi->setAxisTitle("Phi of Hits (rad)",1);
00317     meCaloHcalPhi->setAxisTitle("Count",2);
00318 
00319     sprintf(hname,"hCaloHcalEta");
00320     sprintf(htitle,"Hcal hits, eta");
00321     meCaloHcalEta = dbe->book1D(hname,htitle,100,-5.5,5.5);
00322     meCaloHcalEta->setAxisTitle("Eta of Hits",1);
00323     meCaloHcalEta->setAxisTitle("Count",2);
00324     
00325     // SiPixels
00326     dbe->setCurrentFolder("GlobalHitsV/SiPixels");
00327     sprintf(hname,"hTrackerPx1");
00328     sprintf(htitle,"Pixel hits");
00329     meTrackerPx[0] = dbe->book1D(hname,htitle,100,0.,10000.);
00330     sprintf(hname,"hTrackerPx2");
00331     meTrackerPx[1] = dbe->book1D(hname,htitle,100,-0.5,99.5);
00332     for (Int_t i = 0; i < 2; ++i) {
00333       meTrackerPx[i]->setAxisTitle("Number of Pixel Hits",1);
00334       meTrackerPx[i]->setAxisTitle("Count",2);
00335     }
00336 
00337     sprintf(hname,"hTrackerPxPhi");
00338     sprintf(htitle,"Pixel hits phi/rad");
00339     meTrackerPxPhi = dbe->book1D(hname,htitle,100,-3.2,3.2);
00340     meTrackerPxPhi->setAxisTitle("Phi of Hits (rad)",1);
00341     meTrackerPxPhi->setAxisTitle("Count",2);
00342 
00343     sprintf(hname,"hTrackerPxEta");
00344     sprintf(htitle,"Pixel hits eta");
00345     meTrackerPxEta = dbe->book1D(hname,htitle,100,-3.5,3.5);
00346     meTrackerPxEta->setAxisTitle("Eta of Hits",1);
00347     meTrackerPxEta->setAxisTitle("Count",2);
00348 
00349     sprintf(hname,"hTrackerPxBToF");
00350     sprintf(htitle,"Pixel barrel hits, ToF/ns");
00351     meTrackerPxBToF = dbe->book1D(hname,htitle,100,0.,40.);
00352     meTrackerPxBToF->setAxisTitle("Time of Flight of Hits (ns)",1);
00353     meTrackerPxBToF->setAxisTitle("Count",2);
00354 
00355     sprintf(hname,"hTrackerPxBR");
00356     sprintf(htitle,"Pixel barrel hits, R/cm");
00357     meTrackerPxBR = dbe->book1D(hname,htitle,100,0.,50.);
00358     meTrackerPxBR->setAxisTitle("R of Hits (cm)",1);
00359     meTrackerPxBR->setAxisTitle("Count",2);
00360 
00361     sprintf(hname,"hTrackerPxFToF");
00362     sprintf(htitle,"Pixel forward hits, ToF/ns");
00363     meTrackerPxFToF = dbe->book1D(hname,htitle,100,0.,50.);
00364     meTrackerPxFToF->setAxisTitle("Time of Flight of Hits (ns)",1);
00365     meTrackerPxFToF->setAxisTitle("Count",2);
00366 
00367     sprintf(hname,"hTrackerPxFZ");
00368     sprintf(htitle,"Pixel forward hits, Z/cm");
00369     meTrackerPxFZ = dbe->book1D(hname,htitle,200,-100.,100.);
00370     meTrackerPxFZ->setAxisTitle("Z of Hits (cm)",1);
00371     meTrackerPxFZ->setAxisTitle("Count",2);
00372 
00373     // SiStrips
00374     dbe->setCurrentFolder("GlobalHitsV/SiPixels");
00375     sprintf(hname,"hTrackerSi1");
00376     sprintf(htitle,"Silicon hits");
00377     meTrackerSi[0] = dbe->book1D(hname,htitle,100,0.,10000.);
00378     sprintf(hname,"hTrackerSi2");
00379     meTrackerSi[1] = dbe->book1D(hname,htitle,100,-0.5,99.5);
00380     for (Int_t i = 0; i < 2; ++i) { 
00381       meTrackerSi[i]->setAxisTitle("Number of Silicon Hits",1);
00382       meTrackerSi[i]->setAxisTitle("Count",2);
00383     }
00384 
00385     sprintf(hname,"hTrackerSiPhi");
00386     sprintf(htitle,"Silicon hits phi/rad");
00387     meTrackerSiPhi = dbe->book1D(hname,htitle,100,-3.2,3.2);
00388     meTrackerSiPhi->setAxisTitle("Phi of Hits (rad)",1);
00389     meTrackerSiPhi->setAxisTitle("Count",2);
00390 
00391     sprintf(hname,"hTrackerSiEta");
00392     sprintf(htitle,"Silicon hits eta");
00393     meTrackerSiEta = dbe->book1D(hname,htitle,100,-3.5,3.5);
00394     meTrackerSiEta->setAxisTitle("Eta of Hits",1);
00395     meTrackerSiEta->setAxisTitle("Count",2);
00396 
00397     sprintf(hname,"hTrackerSiBToF");
00398     sprintf(htitle,"Silicon barrel hits, ToF/ns");
00399     meTrackerSiBToF = dbe->book1D(hname,htitle,100,0.,50.);
00400     meTrackerSiBToF->setAxisTitle("Time of Flight of Hits (ns)",1);
00401     meTrackerSiBToF->setAxisTitle("Count",2);
00402 
00403     sprintf(hname,"hTrackerSiBR");
00404     sprintf(htitle,"Silicon barrel hits, R/cm");
00405     meTrackerSiBR = dbe->book1D(hname,htitle,100,0.,200.);
00406     meTrackerSiBR->setAxisTitle("R of Hits (cm)",1);
00407     meTrackerSiBR->setAxisTitle("Count",2);
00408 
00409     sprintf(hname,"hTrackerSiFToF");
00410     sprintf(htitle,"Silicon forward hits, ToF/ns");
00411     meTrackerSiFToF = dbe->book1D(hname,htitle,100,0.,75.);
00412     meTrackerSiFToF->setAxisTitle("Time of Flight of Hits (ns)",1);
00413     meTrackerSiFToF->setAxisTitle("Count",2);
00414 
00415     sprintf(hname,"hTrackerSiFZ");
00416     sprintf(htitle,"Silicon forward hits, Z/cm");
00417     meTrackerSiFZ = dbe->book1D(hname,htitle,200,-300.,300.);
00418     meTrackerSiFZ->setAxisTitle("Z of Hits (cm)",1);
00419     meTrackerSiFZ->setAxisTitle("Count",2);
00420 
00421     // muon
00422     dbe->setCurrentFolder("GlobalHitsV/Muons");
00423     sprintf(hname,"hMuon1");
00424     sprintf(htitle,"Muon hits");
00425     meMuon[0] = dbe->book1D(hname,htitle,100,0.,10000.);
00426     sprintf(hname,"hMuon2");
00427     meMuon[1] = dbe->book1D(hname,htitle,100,-0.5,99.5);
00428     for (Int_t i = 0; i < 2; ++i) { 
00429       meMuon[i]->setAxisTitle("Number of Muon Hits",1);
00430       meMuon[i]->setAxisTitle("Count",2);
00431     }  
00432 
00433     sprintf(hname,"hMuonPhi");
00434     sprintf(htitle,"Muon hits phi/rad");
00435     meMuonPhi = dbe->book1D(hname,htitle,100,-3.2,3.2);
00436     meMuonPhi->setAxisTitle("Phi of Hits (rad)",1);
00437     meMuonPhi->setAxisTitle("Count",2);
00438 
00439     sprintf(hname,"hMuonEta");
00440     sprintf(htitle,"Muon hits eta");
00441     meMuonEta = dbe->book1D(hname,htitle,100,-3.5,3.5);
00442     meMuonEta->setAxisTitle("Eta of Hits",1);
00443     meMuonEta->setAxisTitle("Count",2);
00444 
00445     sprintf(hname,"hMuonCscToF1");
00446     sprintf(htitle,"Muon CSC hits, ToF/ns");
00447     meMuonCscToF[0] = dbe->book1D(hname,htitle,100,0.,250.);
00448     sprintf(hname,"hMuonCscToF2");
00449     meMuonCscToF[1] = dbe->book1D(hname,htitle,100,0.,50.);
00450     for (Int_t i = 0; i < 2; ++i) {   
00451       meMuonCscToF[i]->setAxisTitle("Time of Flight of Hits (ns)",1);
00452       meMuonCscToF[i]->setAxisTitle("Count",2);
00453     }  
00454 
00455     sprintf(hname,"hMuonCscZ");
00456     sprintf(htitle,"Muon CSC hits, Z/cm");
00457     meMuonCscZ = dbe->book1D(hname,htitle,200,-1500.,1500.);
00458     meMuonCscZ->setAxisTitle("Z of Hits (cm)",1);
00459     meMuonCscZ->setAxisTitle("Count",2);
00460 
00461     sprintf(hname,"hMuonDtToF1");
00462     sprintf(htitle,"Muon DT hits, ToF/ns");
00463     meMuonDtToF[0] = dbe->book1D(hname,htitle,100,0.,250.);
00464     sprintf(hname,"hMuonDtToF2");
00465     meMuonDtToF[1] = dbe->book1D(hname,htitle,100,0.,50.);
00466     for (Int_t i = 0; i < 2; ++i) {   
00467       meMuonDtToF[i]->setAxisTitle("Time of Flight of Hits (ns)",1);
00468       meMuonDtToF[i]->setAxisTitle("Count",2);
00469     } 
00470 
00471     sprintf(hname,"hMuonDtR");
00472     sprintf(htitle,"Muon DT hits, R/cm");
00473     meMuonDtR = dbe->book1D(hname,htitle,100,0.,1500.); 
00474     meMuonDtR->setAxisTitle("R of Hits (cm)",1);
00475     meMuonDtR->setAxisTitle("Count",2);
00476 
00477     sprintf(hname,"hMuonRpcFToF1");
00478     sprintf(htitle,"Muon RPC forward hits, ToF/ns");
00479     meMuonRpcFToF[0] = dbe->book1D(hname,htitle,100,0.,250.);
00480     sprintf(hname,"hMuonRpcFToF2_4305");
00481     meMuonRpcFToF[1] = dbe->book1D(hname,htitle,100,0.,50.);
00482     for (Int_t i = 0; i < 2; ++i) {   
00483       meMuonRpcFToF[i]->setAxisTitle("Time of Flight of Hits (ns)",1);
00484       meMuonRpcFToF[i]->setAxisTitle("Count",2);
00485     }  
00486 
00487     sprintf(hname,"hMuonRpcFZ");
00488     sprintf(htitle,"Muon RPC forward hits, Z/cm");
00489     meMuonRpcFZ = dbe->book1D(hname,htitle,201,-1500.,1500.);
00490     meMuonRpcFZ->setAxisTitle("Z of Hits (cm)",1);
00491     meMuonRpcFZ->setAxisTitle("Count",2);
00492 
00493     sprintf(hname,"hMuonRpcBToF1");
00494     sprintf(htitle,"Muon RPC barrel hits, ToF/ns");
00495     meMuonRpcBToF[0] = dbe->book1D(hname,htitle,100,0.,250.);
00496     sprintf(hname,"hMuonRpcBToF2");
00497     meMuonRpcBToF[1] = dbe->book1D(hname,htitle,100,0.,50.);
00498     for (Int_t i = 0; i < 2; ++i) {   
00499       meMuonRpcBToF[i]->setAxisTitle("Time of Flight of Hits (ns)",1);
00500       meMuonRpcBToF[i]->setAxisTitle("Count",2);
00501     }
00502 
00503     sprintf(hname,"hMuonRpcBR");
00504     sprintf(htitle,"Muon RPC barrel hits, R/cm");
00505     meMuonRpcBR = dbe->book1D(hname,htitle,100,0.,1500.);
00506     meMuonRpcBR->setAxisTitle("R of Hits (cm)",1);
00507     meMuonRpcBR->setAxisTitle("Count",2); 
00508   }
00509 }
00510 
00511 GlobalHitsHistogrammer::~GlobalHitsHistogrammer() 
00512 {
00513   if (doOutput)
00514     if (outputfile.size() != 0 && dbe) dbe->save(outputfile);
00515 }
00516 
00517 void GlobalHitsHistogrammer::beginJob( void )
00518 {
00519   return;
00520 }
00521 
00522 void GlobalHitsHistogrammer::endJob()
00523 {
00524   std::string MsgLoggerCat = "GlobalHitsHistogrammer_endJob";
00525   if (verbosity >= 0)
00526     edm::LogInfo(MsgLoggerCat) 
00527       << "Terminating having processed " << count << " events.";
00528   return;
00529 }
00530 
00531 void GlobalHitsHistogrammer::analyze(const edm::Event& iEvent, 
00532                                  const edm::EventSetup& iSetup)
00533 {
00534   std::string MsgLoggerCat = "GlobalHitsHistogrammer_analyze";
00535 
00536   // keep track of number of events processed
00537   ++count;
00538 
00539   // get event id information
00540   int nrun = iEvent.id().run();
00541   int nevt = iEvent.id().event();
00542 
00543   if (verbosity > 0) {
00544     edm::LogInfo(MsgLoggerCat)
00545       << "Processing run " << nrun << ", event " << nevt
00546       << " (" << count << " events total)";
00547   } else if (verbosity == 0) {
00548     if (nevt%frequency == 0 || nevt == 1) {
00549       edm::LogInfo(MsgLoggerCat)
00550         << "Processing run " << nrun << ", event " << nevt
00551         << " (" << count << " events total)";
00552     }
00553   }
00554 
00555   // look at information available in the event
00556   if (getAllProvenances) {
00557 
00558     std::vector<const edm::Provenance*> AllProv;
00559     iEvent.getAllProvenance(AllProv);
00560 
00561     if (verbosity >= 0)
00562       edm::LogInfo(MsgLoggerCat)
00563         << "Number of Provenances = " << AllProv.size();
00564 
00565     if (printProvenanceInfo && (verbosity >= 0)) {
00566       TString eventout("\nProvenance info:\n");      
00567 
00568       for (unsigned int i = 0; i < AllProv.size(); ++i) {
00569         eventout += "\n       ******************************";
00570         eventout += "\n       Module       : ";
00571         eventout += AllProv[i]->moduleLabel();
00572         eventout += "\n       ProductID    : ";
00573         eventout += AllProv[i]->productID().id();
00574         eventout += "\n       ClassName    : ";
00575         eventout += AllProv[i]->className();
00576         eventout += "\n       InstanceName : ";
00577         eventout += AllProv[i]->productInstanceName();
00578         eventout += "\n       BranchName   : ";
00579         eventout += AllProv[i]->branchName();
00580       }
00581       eventout += "\n       ******************************\n";
00582       edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00583       printProvenanceInfo = false;
00584     }
00585     getAllProvenances = false;
00586   }
00587 
00588   // fill histograms
00589   edm::Handle<PGlobalSimHit> srcGlobalHits;
00590   iEvent.getByLabel(GlobalHitSrc_,srcGlobalHits);
00591   if (!srcGlobalHits.isValid()) {
00592     edm::LogWarning(MsgLoggerCat)
00593       << "Unable to find PGlobalSimHit in event!";
00594     return;
00595   }
00596 
00597   nPxlBrlHits = srcGlobalHits->getnPxlBrlHits();
00598   nPxlFwdHits = srcGlobalHits->getnPxlFwdHits();
00599   nPxlHits = nPxlBrlHits + nPxlFwdHits;
00600   nSiBrlHits = srcGlobalHits->getnSiBrlHits();
00601   nSiFwdHits = srcGlobalHits->getnSiFwdHits();
00602   nSiHits = nSiBrlHits + nSiFwdHits;    
00603   nMuonDtHits = srcGlobalHits->getnMuonDtHits();
00604   nMuonCscHits = srcGlobalHits->getnMuonCscHits();
00605   nMuonRpcBrlHits = srcGlobalHits->getnMuonRpcBrlHits();
00606   nMuonRpcFwdHits = srcGlobalHits->getnMuonRpcFwdHits();
00607   nMuonHits = nMuonDtHits + nMuonCscHits + nMuonRpcBrlHits + nMuonRpcFwdHits;
00608 
00609   for (Int_t i = 0; i < 2; ++i) {
00610     meMCRGP[i]->Fill((float)srcGlobalHits->getnRawGenPart());
00611     meMCG4Vtx[i]->Fill((float)srcGlobalHits->getnG4Vtx());
00612     meMCG4Trk[i]->Fill((float)srcGlobalHits->getnG4Trk());
00613     meCaloEcal[i]->Fill((float)srcGlobalHits->getnECalHits());
00614     meCaloPreSh[i]->Fill((float)srcGlobalHits->getnPreShHits());
00615     meCaloHcal[i]->Fill((float)srcGlobalHits->getnHCalHits());
00616     meTrackerPx[i]->Fill((float)nPxlHits);
00617     meTrackerSi[i]->Fill((float)nSiHits);
00618     meMuon[i]->Fill((float)nMuonHits);
00619   }
00620 
00621   // get G4Vertex info
00622   std::vector<PGlobalSimHit::Vtx> G4Vtx = srcGlobalHits->getG4Vtx();
00623   for (unsigned int i = 0; i < G4Vtx.size(); ++i) {
00624     for (int j = 0; j < 2; ++j) {
00625       meGeantVtxX[j]->Fill(G4Vtx[i].x);
00626       meGeantVtxY[j]->Fill(G4Vtx[i].y);
00627       meGeantVtxZ[j]->Fill(G4Vtx[i].z);
00628     }
00629   }
00630   
00631   // get G4Track info
00632   std::vector<PGlobalSimHit::Trk> G4Trk = srcGlobalHits->getG4Trk();
00633   for (unsigned int i = 0; i < G4Trk.size(); ++i) {
00634     meGeantTrkPt->Fill(G4Trk[i].pt);
00635     meGeantTrkE->Fill(G4Trk[i].e);
00636   }
00637   
00638   // get Ecal info
00639   std::vector<PGlobalSimHit::CalHit> ECalHits = 
00640     srcGlobalHits->getECalHits();
00641   for (unsigned int i = 0; i < ECalHits.size(); ++i) {
00642     for (Int_t j = 0; j < 2; ++j) {
00643         meCaloEcalE[j]->Fill(ECalHits[i].e);
00644         meCaloEcalToF[j]->Fill(ECalHits[i].tof);
00645     }
00646     meCaloEcalPhi->Fill(ECalHits[i].phi);
00647     meCaloEcalEta->Fill(ECalHits[i].eta);
00648   }
00649   
00650   // get PreShower info
00651   std::vector<PGlobalSimHit::CalHit> PreShHits = 
00652     srcGlobalHits->getPreShHits();
00653   for (unsigned int i = 0; i < PreShHits.size(); ++i) {
00654     for (Int_t j = 0; j < 2; ++j) {
00655       meCaloPreShE[j]->Fill(PreShHits[i].e);
00656       meCaloPreShToF[j]->Fill(PreShHits[i].tof);
00657     }
00658     meCaloPreShPhi->Fill(PreShHits[i].phi);
00659     meCaloPreShEta->Fill(PreShHits[i].eta);
00660   }
00661   
00662   // get Hcal info
00663   std::vector<PGlobalSimHit::CalHit> HCalHits = 
00664     srcGlobalHits->getHCalHits();
00665   for (unsigned int i = 0; i < HCalHits.size(); ++i) {
00666     for (Int_t j = 0; j < 2; ++j) {
00667       meCaloHcalE[j]->Fill(HCalHits[i].e);
00668       meCaloHcalToF[j]->Fill(HCalHits[i].tof);
00669     }
00670     meCaloHcalPhi->Fill(HCalHits[i].phi);
00671     meCaloHcalEta->Fill(HCalHits[i].eta);
00672   }
00673   
00674   // get Pixel Barrel info
00675   std::vector<PGlobalSimHit::BrlHit> PxlBrlHits = 
00676     srcGlobalHits->getPxlBrlHits();
00677   for (unsigned int i = 0; i < PxlBrlHits.size(); ++i) {
00678     meTrackerPxPhi->Fill(PxlBrlHits[i].phi);
00679     meTrackerPxEta->Fill(PxlBrlHits[i].eta);
00680     meTrackerPxBToF->Fill(PxlBrlHits[i].tof);
00681     meTrackerPxBR->Fill(PxlBrlHits[i].r);
00682   }
00683   
00684   // get Pixel Forward info
00685   std::vector<PGlobalSimHit::FwdHit> PxlFwdHits = 
00686     srcGlobalHits->getPxlFwdHits();
00687   for (unsigned int i = 0; i < PxlFwdHits.size(); ++i) {
00688     meTrackerPxPhi->Fill(PxlFwdHits[i].phi);
00689     meTrackerPxEta->Fill(PxlFwdHits[i].eta);
00690     meTrackerPxFToF->Fill(PxlFwdHits[i].tof);
00691     meTrackerPxFZ->Fill(PxlFwdHits[i].z);
00692   }
00693   
00694   // get Strip Barrel info
00695   std::vector<PGlobalSimHit::BrlHit> SiBrlHits = 
00696     srcGlobalHits->getSiBrlHits();
00697   for (unsigned int i = 0; i < SiBrlHits.size(); ++i) {
00698     meTrackerSiPhi->Fill(SiBrlHits[i].phi);
00699     meTrackerSiEta->Fill(SiBrlHits[i].eta);
00700     meTrackerSiBToF->Fill(SiBrlHits[i].tof);
00701     meTrackerSiBR->Fill(SiBrlHits[i].r);
00702   }
00703   
00704   // get Strip Forward info
00705   std::vector<PGlobalSimHit::FwdHit> SiFwdHits = 
00706     srcGlobalHits->getSiFwdHits();
00707   for (unsigned int i = 0; i < SiFwdHits.size(); ++i) {
00708     meTrackerSiPhi->Fill(SiFwdHits[i].phi);
00709     meTrackerSiEta->Fill(SiFwdHits[i].eta);
00710     meTrackerSiFToF->Fill(SiFwdHits[i].tof);
00711     meTrackerSiFZ->Fill(SiFwdHits[i].z);
00712   }
00713   
00714   // get Muon CSC info
00715   std::vector<PGlobalSimHit::FwdHit> MuonCscHits = 
00716     srcGlobalHits->getMuonCscHits();
00717   for (unsigned int i = 0; i < MuonCscHits.size(); ++i) {
00718     meMuonPhi->Fill(MuonCscHits[i].phi);
00719     meMuonEta->Fill(MuonCscHits[i].eta);
00720     for (Int_t j = 0; j < 2; ++j) {
00721       meMuonCscToF[j]->Fill(MuonCscHits[i].tof);
00722     }
00723     meMuonCscZ->Fill(MuonCscHits[i].z);
00724   }    
00725   
00726   // get Muon DT info
00727   std::vector<PGlobalSimHit::BrlHit> MuonDtHits = 
00728     srcGlobalHits->getMuonDtHits();
00729   for (unsigned int i = 0; i < MuonDtHits.size(); ++i) {
00730     meMuonPhi->Fill(MuonDtHits[i].phi);
00731     meMuonEta->Fill(MuonDtHits[i].eta);
00732     for (Int_t j = 0; j < 2; ++j) {
00733       meMuonDtToF[j]->Fill(MuonDtHits[i].tof);
00734     }
00735     meMuonDtR->Fill(MuonDtHits[i].r);
00736   }
00737   
00738   // get Muon RPC forward info
00739   std::vector<PGlobalSimHit::FwdHit> MuonRpcFwdHits = 
00740     srcGlobalHits->getMuonRpcFwdHits();
00741   for (unsigned int i = 0; i < MuonRpcFwdHits.size(); ++i) {
00742     meMuonPhi->Fill(MuonRpcFwdHits[i].phi);
00743     meMuonEta->Fill(MuonRpcFwdHits[i].eta);
00744     for (Int_t j = 0; j < 2; ++j) {
00745       meMuonRpcFToF[j]->Fill(MuonRpcFwdHits[i].tof);
00746     }
00747     meMuonRpcFZ->Fill(MuonRpcFwdHits[i].z);
00748   }    
00749   
00750   // get Muon RPC barrel info
00751   std::vector<PGlobalSimHit::BrlHit> MuonRpcBrlHits = 
00752     srcGlobalHits->getMuonRpcBrlHits();
00753   for (unsigned int i = 0; i < MuonRpcBrlHits.size(); ++i) {
00754     meMuonPhi->Fill(MuonRpcBrlHits[i].phi);
00755     meMuonEta->Fill(MuonRpcBrlHits[i].eta);
00756     for (Int_t j = 0; j < 2; ++j) {
00757       meMuonRpcBToF[j]->Fill(MuonRpcBrlHits[i].tof);
00758     }
00759     meMuonRpcBR->Fill(MuonRpcBrlHits[i].r);
00760   }   
00761   
00762   return;
00763 }
00764 
00765