00001
00010 #include "Validation/GlobalDigis/interface/GlobalDigisAnalyzer.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012
00013 GlobalDigisAnalyzer::GlobalDigisAnalyzer(const edm::ParameterSet& iPSet) :
00014 fName(""), verbosity(0), frequency(0), label(""), getAllProvenances(false),
00015 printProvenanceInfo(false), hitsProducer(""), theCSCStripPedestalSum(0),
00016 theCSCStripPedestalCount(0), count(0)
00017 {
00018 std::string MsgLoggerCat = "GlobalDigisAnalyzer_GlobalDigisAnalyzer";
00019
00020
00021 fName = iPSet.getUntrackedParameter<std::string>("Name");
00022 verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
00023 frequency = iPSet.getUntrackedParameter<int>("Frequency");
00024 edm::ParameterSet m_Prov =
00025 iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
00026 getAllProvenances =
00027 m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
00028 printProvenanceInfo =
00029 m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
00030 hitsProducer = iPSet.getParameter<std::string>("hitsProducer");
00031
00032
00033 ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
00034 ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
00035 ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
00036 HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
00037 HCalDigi_ = iPSet.getParameter<edm::InputTag>("HCalDigi");
00038 SiStripSrc_ = iPSet.getParameter<edm::InputTag>("SiStripSrc");
00039 SiPxlSrc_ = iPSet.getParameter<edm::InputTag>("SiPxlSrc");
00040 MuDTSrc_ = iPSet.getParameter<edm::InputTag>("MuDTSrc");
00041 MuCSCStripSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCStripSrc");
00042 MuCSCWireSrc_ = iPSet.getParameter<edm::InputTag>("MuCSCWireSrc");
00043 MuRPCSrc_ = iPSet.getParameter<edm::InputTag>("MuRPCSrc");
00044
00045
00046
00047 verbosity %= 10;
00048
00049
00050 if (verbosity >= 0) {
00051 edm::LogInfo(MsgLoggerCat)
00052 << "\n===============================\n"
00053 << "Initialized as EDAnalyzer with parameter values:\n"
00054 << " Name = " << fName << "\n"
00055 << " Verbosity = " << verbosity << "\n"
00056 << " Frequency = " << frequency << "\n"
00057 << " GetProv = " << getAllProvenances << "\n"
00058 << " PrintProv = " << printProvenanceInfo << "\n"
00059 << " ECalEBSrc = " << ECalEBSrc_.label()
00060 << ":" << ECalEBSrc_.instance() << "\n"
00061 << " ECalEESrc = " << ECalEESrc_.label()
00062 << ":" << ECalEESrc_.instance() << "\n"
00063 << " ECalESSrc = " << ECalESSrc_.label()
00064 << ":" << ECalESSrc_.instance() << "\n"
00065 << " HCalSrc = " << HCalSrc_.label()
00066 << ":" << HCalSrc_.instance() << "\n"
00067 << " HCalDigi = " << HCalDigi_.label()
00068 << ":" << HCalDigi_.instance() << "\n"
00069 << " SiStripSrc = " << SiStripSrc_.label()
00070 << ":" << SiStripSrc_.instance() << "\n"
00071 << " SiPixelSrc = " << SiPxlSrc_.label()
00072 << ":" << SiPxlSrc_.instance() << "\n"
00073 << " MuDTSrc = " << MuDTSrc_.label()
00074 << ":" << MuDTSrc_.instance() << "\n"
00075 << " MuCSCStripSrc = " << MuCSCStripSrc_.label()
00076 << ":" << MuCSCStripSrc_.instance() << "\n"
00077 << " MuCSCWireSrc = " << MuCSCWireSrc_.label()
00078 << ":" << MuCSCWireSrc_.instance() << "\n"
00079 << " MuRPCSrc = " << MuRPCSrc_.label()
00080 << ":" << MuRPCSrc_.instance() << "\n"
00081 << "===============================\n";
00082 }
00083
00084
00085
00086 dbe = 0;
00087 dbe = edm::Service<DQMStore>().operator->();
00088 if (dbe) {
00089 if (verbosity > 0 ) {
00090 dbe->setVerbose(1);
00091 } else {
00092 dbe->setVerbose(0);
00093 }
00094 }
00095 if (dbe) {
00096 if (verbosity > 0 ) dbe->showDirStructure();
00097 }
00098
00099
00100
00101
00102 if (dbe) {
00103 std::string SiStripString[19] = {"TECW1", "TECW2", "TECW3", "TECW4",
00104 "TECW5", "TECW6", "TECW7", "TECW8",
00105 "TIBL1", "TIBL2", "TIBL3", "TIBL4",
00106 "TIDW1", "TIDW2", "TIDW3", "TOBL1",
00107 "TOBL2", "TOBL3", "TOBL4"};
00108 for(int i = 0; i<19; ++i) {
00109 mehSiStripn[i]=0;
00110 mehSiStripADC[i]=0;
00111 mehSiStripStrip[i]=0;
00112 }
00113 std::string hcharname, hchartitle;
00114 dbe->setCurrentFolder("GlobalDigisV/SiStrips");
00115 for(int amend = 0; amend < 19; ++amend) {
00116 hcharname = "hSiStripn_"+SiStripString[amend];
00117 hchartitle= SiStripString[amend]+" Digis";
00118 mehSiStripn[amend] = dbe->book1D(hcharname,hchartitle,5000,0.,10000.);
00119 mehSiStripn[amend]->setAxisTitle("Number of Digis",1);
00120 mehSiStripn[amend]->setAxisTitle("Count",2);
00121
00122 hcharname = "hSiStripADC_"+SiStripString[amend];
00123 hchartitle= SiStripString[amend]+" ADC";
00124 mehSiStripADC[amend] = dbe->book1D(hcharname,hchartitle,150,0.0,300.);
00125 mehSiStripADC[amend]->setAxisTitle("ADC",1);
00126 mehSiStripADC[amend]->setAxisTitle("Count",2);
00127
00128 hcharname = "hSiStripStripADC_"+SiStripString[amend];
00129 hchartitle= SiStripString[amend]+" Strip";
00130 mehSiStripStrip[amend] = dbe->book1D(hcharname,hchartitle,200,0.0,800.);
00131 mehSiStripStrip[amend]->setAxisTitle("Strip Number",1);
00132 mehSiStripStrip[amend]->setAxisTitle("Count",2);
00133 }
00134
00135
00136 std::string HCalString[4] = {"HB", "HE", "HO","HF"};
00137 float calnUpper[4] = {30000.,30000.,30000.,20000.};
00138 float calnLower[4]={0.,0.,0.,0.};
00139 float SHEUpper[4]={1.,1.,1.,1.};
00140 float SHEvAEEUpper[4] = {5000, 5000, 5000, 5000};
00141 float SHEvAEELower[4] = {-5000, -5000, -5000, -5000};
00142 int SHEvAEEnBins[4] = {200,200,200,200};
00143 double ProfileUpper[4] = {1.,1.,1.,1.};
00144
00145 for(int i =0; i<4; ++i) {
00146 mehHcaln[i]=0;
00147 mehHcalAEE[i]=0;
00148 mehHcalSHE[i]=0;
00149 mehHcalAEESHE[i]=0;
00150 mehHcalSHEvAEE[i]=0;
00151 }
00152 dbe->setCurrentFolder("GlobalDigisV/HCals");
00153
00154 for(int amend = 0; amend < 4; ++amend) {
00155 hcharname = "hHcaln_"+HCalString[amend];
00156 hchartitle= HCalString[amend]+" digis";
00157 mehHcaln[amend] = dbe->book1D(hcharname,hchartitle, 10000, calnLower[amend],
00158 calnUpper[amend]);
00159 mehHcaln[amend]->setAxisTitle("Number of Digis",1);
00160 mehHcaln[amend]->setAxisTitle("Count",2);
00161
00162 hcharname = "hHcalAEE_"+HCalString[amend];
00163 hchartitle= HCalString[amend]+"Cal AEE";
00164 mehHcalAEE[amend] = dbe->book1D(hcharname,hchartitle, 60, -10., 50.);
00165 mehHcalAEE[amend]->setAxisTitle("Analog Equivalent Energy",1);
00166 mehHcalAEE[amend]->setAxisTitle("Count",2);
00167
00168 hcharname = "hHcalSHE_"+HCalString[amend];
00169 hchartitle= HCalString[amend]+"Cal SHE";
00170 mehHcalSHE[amend] = dbe->book1D(hcharname,hchartitle, 1000, 0.0,
00171 SHEUpper[amend]);
00172 mehHcalSHE[amend]->setAxisTitle("Simulated Hit Energy",1);
00173 mehHcalSHE[amend]->setAxisTitle("Count",2);
00174
00175 hcharname = "hHcalAEESHE_"+HCalString[amend];
00176 hchartitle= HCalString[amend]+"Cal AEE/SHE";
00177 mehHcalAEESHE[amend] = dbe->book1D(hcharname, hchartitle, SHEvAEEnBins[amend],
00178 SHEvAEELower[amend],
00179 SHEvAEEUpper[amend]);
00180 mehHcalAEESHE[amend]->setAxisTitle("ADC / SHE",1);
00181 mehHcalAEESHE[amend]->setAxisTitle("Count",2);
00182
00183 hcharname = "hHcalSHEvAEE_"+HCalString[amend];
00184 hchartitle= HCalString[amend]+"Cal SHE vs. AEE";
00185 mehHcalSHEvAEE[amend] = dbe->bookProfile(hcharname,hchartitle, 60, -10.,
00186 50., 100, 0.,
00187 (float)ProfileUpper[amend],"");
00188 mehHcalSHEvAEE[amend]->setAxisTitle("AEE / SHE",1);
00189 mehHcalSHEvAEE[amend]->setAxisTitle("SHE",2);
00190
00191 }
00192
00193
00194 std::string ECalString[2] = {"EB","EE"};
00195
00196 for(int i =0; i<2; ++i) {
00197 mehEcaln[i]=0;
00198 mehEcalAEE[i]=0;
00199 mehEcalSHE[i]=0;
00200 mehEcalMaxPos[i]=0;
00201 mehEcalMultvAEE[i]=0;
00202 mehEcalSHEvAEESHE[i]=0;
00203 }
00204 dbe->setCurrentFolder("GlobalDigisV/ECals");
00205
00206 for(int amend = 0; amend < 2; ++amend) {
00207 hcharname = "hEcaln_"+ECalString[amend];
00208 hchartitle= ECalString[amend]+" digis";
00209 mehEcaln[amend] = dbe->book1D(hcharname,hchartitle, 3000, 0., 40000.);
00210 mehEcaln[amend]->setAxisTitle("Number of Digis",1);
00211 mehEcaln[amend]->setAxisTitle("Count",2);
00212
00213 hcharname = "hEcalAEE_"+ECalString[amend];
00214 hchartitle= ECalString[amend]+"Cal AEE";
00215 mehEcalAEE[amend] = dbe->book1D(hcharname,hchartitle, 1000, 0., 100.);
00216 mehEcalAEE[amend]->setAxisTitle("Analog Equivalent Energy",1);
00217 mehEcalAEE[amend]->setAxisTitle("Count",2);
00218
00219 hcharname = "hEcalSHE_"+ECalString[amend];
00220 hchartitle= ECalString[amend]+"Cal SHE";
00221 mehEcalSHE[amend] = dbe->book1D(hcharname,hchartitle, 500, 0., 50.);
00222 mehEcalSHE[amend]->setAxisTitle("Simulated Hit Energy",1);
00223 mehEcalSHE[amend]->setAxisTitle("Count",2);
00224
00225 hcharname = "hEcalMaxPos_"+ECalString[amend];
00226 hchartitle= ECalString[amend]+"Cal MaxPos";
00227 mehEcalMaxPos[amend] = dbe->book1D(hcharname,hchartitle,10, 0., 10.);
00228 mehEcalMaxPos[amend]->setAxisTitle("Maximum Position",1);
00229 mehEcalMaxPos[amend]->setAxisTitle("Count",2);
00230
00231 hcharname = "hEcalSHEvAEESHE_"+ECalString[amend];
00232 hchartitle= ECalString[amend]+"Cal SHE vs. AEE/SHE";
00233 mehEcalSHEvAEESHE[amend] = dbe->bookProfile(hcharname,hchartitle,1000, 0., 100.,
00234 500, 0., 50.,"");
00235 mehEcalSHEvAEESHE[amend]->setAxisTitle("AEE / SHE",1);
00236 mehEcalSHEvAEESHE[amend]->setAxisTitle("SHE",2);
00237
00238 hcharname = "hEcalMultvAEE_"+ECalString[amend];
00239 hchartitle= ECalString[amend]+"Cal Multi vs. AEE";
00240 mehEcalMultvAEE[amend] = dbe->bookProfile(hcharname,hchartitle, 1000, 0., 100.,
00241 4000, 0., 40000.,"");
00242 mehEcalMultvAEE[amend]->setAxisTitle("Analog Equivalent Energy",1);
00243 mehEcalMultvAEE[amend]->setAxisTitle("Number of Digis",2);
00244 }
00245 mehEScaln = 0;
00246
00247 hcharname = "hEcaln_ES";
00248 hchartitle= "ESCAL digis";
00249 mehEScaln = dbe->book1D(hcharname,hchartitle, 1000, 0., 5000.);
00250 mehEScaln->setAxisTitle("Number of Digis",1);
00251 mehEScaln->setAxisTitle("Count",2);
00252
00253 std::string ADCNumber[3] = {"0", "1", "2"};
00254 for(int i =0; i<3; ++i) {
00255 mehEScalADC[i] = 0;
00256 hcharname = "hEcalADC"+ADCNumber[i]+"_ES";
00257 hchartitle= "ESCAL ADC"+ADCNumber[i];
00258 mehEScalADC[i] = dbe->book1D(hcharname,hchartitle, 1500, 0., 1500.);
00259 mehEScalADC[i]->setAxisTitle("ADC"+ADCNumber[i],1);
00260 mehEScalADC[i]->setAxisTitle("Count",2);
00261 }
00262
00263
00264 std::string SiPixelString[7] = {"BRL1", "BRL2", "BRL3", "FWD1n", "FWD1p",
00265 "FWD2n", "FWD2p"};
00266 for(int j =0; j<7; ++j) {
00267 mehSiPixeln[j]=0;
00268 mehSiPixelADC[j]=0;
00269 mehSiPixelRow[j]=0;
00270 mehSiPixelCol[j]=0;
00271 }
00272
00273 dbe->setCurrentFolder("GlobalDigisV/SiPixels");
00274 for(int amend = 0; amend < 7; ++amend) {
00275 hcharname = "hSiPixeln_"+SiPixelString[amend];
00276 hchartitle= SiPixelString[amend]+" Digis";
00277 if(amend<3) mehSiPixeln[amend] = dbe->book1D(hcharname,hchartitle,500,0.,1000.);
00278 else mehSiPixeln[amend] = dbe->book1D(hcharname,hchartitle,500,0.,1000.);
00279 mehSiPixeln[amend]->setAxisTitle("Number of Digis",1);
00280 mehSiPixeln[amend]->setAxisTitle("Count",2);
00281
00282 hcharname = "hSiPixelADC_"+SiPixelString[amend];
00283 hchartitle= SiPixelString[amend]+" ADC";
00284 mehSiPixelADC[amend] = dbe->book1D(hcharname,hchartitle,150,0.0,300.);
00285 mehSiPixelADC[amend]->setAxisTitle("ADC",1);
00286 mehSiPixelADC[amend]->setAxisTitle("Count",2);
00287
00288 hcharname = "hSiPixelRow_"+SiPixelString[amend];
00289 hchartitle= SiPixelString[amend]+" Row";
00290 mehSiPixelRow[amend] = dbe->book1D(hcharname,hchartitle,100,0.0,100.);
00291 mehSiPixelRow[amend]->setAxisTitle("Row Number",1);
00292 mehSiPixelRow[amend]->setAxisTitle("Count",2);
00293
00294 hcharname = "hSiPixelColumn_"+SiPixelString[amend];
00295 hchartitle= SiPixelString[amend]+" Column";
00296 mehSiPixelCol[amend] = dbe->book1D(hcharname,hchartitle,200,0.0,500.);
00297 mehSiPixelCol[amend]->setAxisTitle("Column Number",1);
00298 mehSiPixelCol[amend]->setAxisTitle("Count",2);
00299 }
00300
00301
00302 dbe->setCurrentFolder("GlobalDigisV/Muons");
00303
00304
00305 std::string MuonString[4] = {"MB1", "MB2", "MB3", "MB4"};
00306
00307 for(int i =0; i < 4; ++i) {
00308 mehDtMuonn[i] = 0;
00309 mehDtMuonLayer[i] = 0;
00310 mehDtMuonTime[i] = 0;
00311 mehDtMuonTimevLayer[i] = 0;
00312 }
00313
00314 for(int j = 0; j < 4; ++j) {
00315 hcharname = "hDtMuonn_"+MuonString[j];
00316 hchartitle= MuonString[j]+" digis";
00317 mehDtMuonn[j] = dbe->book1D(hcharname,hchartitle,250, 0., 500.);
00318 mehDtMuonn[j]->setAxisTitle("Number of Digis",1);
00319 mehDtMuonn[j]->setAxisTitle("Count",2);
00320
00321 hcharname = "hDtLayer_"+MuonString[j];
00322 hchartitle= MuonString[j]+" Layer";
00323 mehDtMuonLayer[j] = dbe->book1D(hcharname,hchartitle,12, 1., 13.);
00324 mehDtMuonLayer[j]->setAxisTitle("4 * (SuperLayer - 1) + Layer",1);
00325 mehDtMuonLayer[j]->setAxisTitle("Count",2);
00326
00327 hcharname = "hDtMuonTime_"+MuonString[j];
00328 hchartitle= MuonString[j]+" Time";
00329 mehDtMuonTime[j] = dbe->book1D(hcharname,hchartitle,300, 400., 1000.);
00330 mehDtMuonTime[j]->setAxisTitle("Time",1);
00331 mehDtMuonTime[j]->setAxisTitle("Count",2);
00332
00333 hcharname = "hDtMuonTimevLayer_"+MuonString[j];
00334 hchartitle= MuonString[j]+" Time vs. Layer";
00335 mehDtMuonTimevLayer[j] = dbe->bookProfile(hcharname,hchartitle,12, 1., 13., 300,
00336 400., 1000.,"");
00337 mehDtMuonTimevLayer[j]->setAxisTitle("4 * (SuperLayer - 1) + Layer",1);
00338 mehDtMuonTimevLayer[j]->setAxisTitle("Time",2);
00339 }
00340
00341
00342 mehCSCStripn = 0;
00343 hcharname = "hCSCStripn";
00344 hchartitle = "CSC Strip digis";
00345 mehCSCStripn = dbe->book1D(hcharname,hchartitle,250, 0., 500.);
00346 mehCSCStripn->setAxisTitle("Number of Digis",1);
00347 mehCSCStripn->setAxisTitle("Count",2);
00348
00349 mehCSCStripADC = 0;
00350 hcharname = "hCSCStripADC";
00351 hchartitle = "CSC Strip ADC";
00352 mehCSCStripADC = dbe->book1D(hcharname,hchartitle, 110, 0., 1100.);
00353 mehCSCStripADC->setAxisTitle("ADC",1);
00354 mehCSCStripADC->setAxisTitle("Count",2);
00355
00356 mehCSCWiren = 0;
00357 hcharname = "hCSCWiren";
00358 hchartitle = "CSC Wire digis";
00359 mehCSCWiren = dbe->book1D(hcharname,hchartitle,250, 0., 500.);
00360 mehCSCWiren->setAxisTitle("Number of Digis",1);
00361 mehCSCWiren->setAxisTitle("Count",2);
00362
00363 mehCSCWireTime = 0;
00364 hcharname = "hCSCWireTime";
00365 hchartitle = "CSC Wire Time";
00366 mehCSCWireTime = dbe->book1D(hcharname,hchartitle,10, 0., 10.);
00367 mehCSCWireTime->setAxisTitle("Time",1);
00368 mehCSCWireTime->setAxisTitle("Count",2);
00369
00370
00371 mehRPCMuonn = 0;
00372 hcharname = "hRPCMuonn";
00373 hchartitle = "RPC digis";
00374 mehCSCStripn = dbe->book1D(hcharname,hchartitle,250, 0., 500.);
00375 mehCSCStripn->setAxisTitle("Number of Digis",1);
00376 mehCSCStripn->setAxisTitle("Count",2);
00377
00378 std::string MuonRPCString[5] = {"Wmin2", "Wmin1", "W0", "Wpu1", "Wpu2"};
00379 for(int i =0; i < 5; ++i) {
00380 mehRPCRes[i] = 0;
00381 }
00382
00383 for(int j = 0; j < 5; ++j) {
00384 hcharname = "hRPCRes_"+MuonRPCString[j];
00385 hchartitle= MuonRPCString[j]+" Digi - Sim";
00386 mehRPCRes[j] = dbe->book1D(hcharname,hchartitle,200, -8., 8.);
00387 mehRPCRes[j]->setAxisTitle("Digi - Sim center of strip x",1);
00388 mehRPCRes[j]->setAxisTitle("Count",2);
00389 }
00390 }
00391
00392
00393
00394
00395 ECalgainConv_[0] = 0.;
00396 ECalgainConv_[1] = 1.;
00397 ECalgainConv_[2] = 2.;
00398 ECalgainConv_[3] = 12.;
00399 ECalbarrelADCtoGeV_ = 0.035;
00400 ECalendcapADCtoGeV_ = 0.06;
00401 }
00402
00403 GlobalDigisAnalyzer::~GlobalDigisAnalyzer() {}
00404
00405 void GlobalDigisAnalyzer::beginJob( void )
00406 {
00407 std::string MsgLoggerCat = "GlobalDigisAnalyzer_beginJob";
00408
00409 EcalMGPAGainRatio * defaultRatios = new EcalMGPAGainRatio();
00410
00411 ECalgainConv_[0] = 0.;
00412 ECalgainConv_[1] = 1.;
00413 ECalgainConv_[2] = defaultRatios->gain12Over6() ;
00414 ECalgainConv_[3] = ECalgainConv_[2]*(defaultRatios->gain6Over1()) ;
00415
00416 delete defaultRatios;
00417
00418 if (verbosity >= 0) {
00419 edm::LogInfo(MsgLoggerCat)
00420 << "Modified Calorimeter gain constants: g0 = " << ECalgainConv_[0]
00421 << ", g1 = " << ECalgainConv_[1] << ", g2 = " << ECalgainConv_[2]
00422 << ", g3 = " << ECalgainConv_[3];
00423 }
00424
00425 return;
00426 }
00427
00428
00429 void GlobalDigisAnalyzer::endJob()
00430 {
00431 std::string MsgLoggerCat = "GlobalDigisAnalyzer_endJob";
00432 if (verbosity >= 0)
00433 edm::LogInfo(MsgLoggerCat)
00434 << "Terminating having processed " << count << " events.";
00435 return;
00436 }
00437
00438 void GlobalDigisAnalyzer::analyze(const edm::Event& iEvent,
00439 const edm::EventSetup& iSetup)
00440 {
00441 std::string MsgLoggerCat = "GlobalDigisAnalyzer_analyze";
00442
00443
00444 ++count;
00445
00446
00447
00448
00449
00450 edm::ESHandle<EcalADCToGeVConstant> pAgc;
00451 iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
00452 const EcalADCToGeVConstant* agc = pAgc.product();
00453 ECalbarrelADCtoGeV_ = agc->getEBValue();
00454 ECalendcapADCtoGeV_ = agc->getEEValue();
00455 if (verbosity >= 0) {
00456 edm::LogInfo(MsgLoggerCat)
00457 << "Modified Calorimeter ADCtoGeV constants: barrel = "
00458 << ECalbarrelADCtoGeV_ << ", endcap = " << ECalendcapADCtoGeV_;
00459 }
00460
00461
00462
00463
00464 int nrun = iEvent.id().run();
00465 int nevt = iEvent.id().event();
00466
00467 if (verbosity > 0) {
00468 edm::LogInfo(MsgLoggerCat)
00469 << "Processing run " << nrun << ", event " << nevt
00470 << " (" << count << " events total)";
00471 } else if (verbosity == 0) {
00472 if (nevt%frequency == 0 || nevt == 1) {
00473 edm::LogInfo(MsgLoggerCat)
00474 << "Processing run " << nrun << ", event " << nevt
00475 << " (" << count << " events total)";
00476 }
00477 }
00478
00479
00480 if (getAllProvenances) {
00481
00482 std::vector<const edm::Provenance*> AllProv;
00483 iEvent.getAllProvenance(AllProv);
00484
00485 if (verbosity >= 0)
00486 edm::LogInfo(MsgLoggerCat)
00487 << "Number of Provenances = " << AllProv.size();
00488
00489 if (printProvenanceInfo && (verbosity >= 0)) {
00490 TString eventout("\nProvenance info:\n");
00491
00492 for (unsigned int i = 0; i < AllProv.size(); ++i) {
00493 eventout += "\n ******************************";
00494 eventout += "\n Module : ";
00495 eventout += AllProv[i]->moduleLabel();
00496 eventout += "\n ProductID : ";
00497 eventout += AllProv[i]->productID().id();
00498 eventout += "\n ClassName : ";
00499 eventout += AllProv[i]->className();
00500 eventout += "\n InstanceName : ";
00501 eventout += AllProv[i]->productInstanceName();
00502 eventout += "\n BranchName : ";
00503 eventout += AllProv[i]->branchName();
00504 }
00505 eventout += "\n ******************************\n";
00506 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00507 printProvenanceInfo = false;
00508 }
00509 getAllProvenances = false;
00510 }
00511
00512
00513
00514 fillECal(iEvent, iSetup);
00515
00516 fillHCal(iEvent, iSetup);
00517
00518 fillTrk(iEvent, iSetup);
00519
00520 fillMuon(iEvent, iSetup);
00521
00522 if (verbosity > 0)
00523 edm::LogInfo (MsgLoggerCat)
00524 << "Done gathering data from event.";
00525
00526 if (verbosity > 2)
00527 edm::LogInfo (MsgLoggerCat)
00528 << "Saving event contents:";
00529
00530 return;
00531 }
00532
00533 void GlobalDigisAnalyzer::fillECal(const edm::Event& iEvent,
00534 const edm::EventSetup& iSetup)
00535 {
00536 std::string MsgLoggerCat = "GlobalDigisAnalyzer_fillECal";
00537
00538 TString eventout;
00539 if (verbosity > 0)
00540 eventout = "\nGathering info:";
00541
00542
00543 edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
00544
00546
00548 bool isBarrel = true;
00549 edm::Handle<EBDigiCollection> EcalDigiEB;
00550 iEvent.getByLabel(ECalEBSrc_, EcalDigiEB);
00551 bool validDigiEB = true;
00552 if (!EcalDigiEB.isValid()) {
00553 LogDebug(MsgLoggerCat)
00554 << "Unable to find EcalDigiEB in event!";
00555 validDigiEB = false;
00556 }
00557 if (validDigiEB) {
00558 if ( EcalDigiEB->size() == 0) isBarrel = false;
00559
00560 if (isBarrel) {
00561
00562
00563 MapType ebSimMap;
00564 const std::string barrelHitsName(hitsProducer+"EcalHitsEB");
00565 iEvent.getByLabel("mix",barrelHitsName,crossingFrame);
00566 bool validXFrame = true;
00567 if (!crossingFrame.isValid()) {
00568 LogDebug(MsgLoggerCat)
00569 << "Unable to find cal barrel crossingFrame in event!";
00570 validXFrame = false;
00571 }
00572 if (validXFrame) {
00573 std::auto_ptr<MixCollection<PCaloHit> >
00574 barrelHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00575
00576
00577 for (MixCollection<PCaloHit>::MixItr hitItr
00578 = barrelHits->begin();
00579 hitItr != barrelHits->end();
00580 ++hitItr) {
00581
00582 EBDetId ebid = EBDetId(hitItr->id());
00583
00584 uint32_t crystid = ebid.rawId();
00585 ebSimMap[crystid] += hitItr->energy();
00586 }
00587 }
00588
00589
00590 const EBDigiCollection *barrelDigi = EcalDigiEB.product();
00591
00592 std::vector<double> ebAnalogSignal;
00593 std::vector<double> ebADCCounts;
00594 std::vector<double> ebADCGains;
00595 ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
00596 ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
00597 ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
00598
00599 int i = 0;
00600 for (unsigned int digis=0; digis<EcalDigiEB->size(); ++digis) {
00601
00602 ++i;
00603
00604 EBDataFrame ebdf = (*barrelDigi)[digis];
00605 int nrSamples = ebdf.size();
00606
00607 EBDetId ebid = ebdf.id () ;
00608
00609 double Emax = 0;
00610 int Pmax = 0;
00611 double pedestalPreSample = 0.;
00612 double pedestalPreSampleAnalog = 0.;
00613
00614 for (int sample = 0 ; sample < nrSamples; ++sample) {
00615 ebAnalogSignal[sample] = 0.;
00616 ebADCCounts[sample] = 0.;
00617 ebADCGains[sample] = -1.;
00618 }
00619
00620
00621 for (int sample = 0 ; sample < nrSamples; ++sample) {
00622
00623 EcalMGPASample thisSample = ebdf[sample];
00624 ebADCCounts[sample] = (thisSample.adc());
00625 ebADCGains[sample] = (thisSample.gainId());
00626 ebAnalogSignal[sample] =
00627 (ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
00628 * ECalbarrelADCtoGeV_);
00629 if (Emax < ebAnalogSignal[sample]) {
00630 Emax = ebAnalogSignal[sample];
00631 Pmax = sample;
00632 }
00633 if ( sample < 3 ) {
00634 pedestalPreSample += ebADCCounts[sample] ;
00635 pedestalPreSampleAnalog +=
00636 ebADCCounts[sample] * ECalgainConv_[(int)ebADCGains[sample]]
00637 * ECalbarrelADCtoGeV_ ;
00638 }
00639
00640 }
00641 pedestalPreSample /= 3. ;
00642 pedestalPreSampleAnalog /= 3. ;
00643
00644
00645 double Erec = Emax - pedestalPreSampleAnalog
00646 * ECalgainConv_[(int)ebADCGains[Pmax]];
00647
00648
00649 mehEcalMaxPos[0]->Fill(Pmax);
00650 mehEcalSHE[0]->Fill(ebSimMap[ebid.rawId()]);
00651 mehEcalAEE[0]->Fill(Erec);
00652
00653 if (ebSimMap[ebid.rawId()]!=0) {
00654 mehEcalSHEvAEESHE[0]->Fill(Erec/ebSimMap[ebid.rawId()],
00655 ebSimMap[ebid.rawId()]);
00656 }
00657
00658
00659
00660
00661 mehEcalMultvAEE[0]->Fill(Pmax,(float)i);
00662 }
00663
00664 if (verbosity > 1) {
00665 eventout += "\n Number of EBDigis collected:.............. ";
00666 eventout += i;
00667 }
00668 mehEcaln[0]->Fill((float)i);
00669 }
00670 }
00671
00673
00675 bool isEndCap = true;
00676 edm::Handle<EEDigiCollection> EcalDigiEE;
00677 iEvent.getByLabel(ECalEESrc_, EcalDigiEE);
00678 bool validDigiEE = true;
00679 if (!EcalDigiEE.isValid()) {
00680 LogDebug(MsgLoggerCat)
00681 << "Unable to find EcalDigiEE in event!";
00682 validDigiEE = false;
00683 }
00684 if (validDigiEE) {
00685 if (EcalDigiEE->size() == 0) isEndCap = false;
00686
00687 if (isEndCap) {
00688
00689
00690 MapType eeSimMap;
00691 const std::string endcapHitsName(hitsProducer+"EcalHitsEE");
00692 iEvent.getByLabel("mix",endcapHitsName,crossingFrame);
00693 bool validXFrame = true;
00694 if (!crossingFrame.isValid()) {
00695 LogDebug(MsgLoggerCat)
00696 << "Unable to find cal endcap crossingFrame in event!";
00697 validXFrame = false;
00698 }
00699 if (validXFrame) {
00700 std::auto_ptr<MixCollection<PCaloHit> >
00701 endcapHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00702
00703
00704 for (MixCollection<PCaloHit>::MixItr hitItr
00705 = endcapHits->begin();
00706 hitItr != endcapHits->end();
00707 ++hitItr) {
00708
00709 EEDetId eeid = EEDetId(hitItr->id());
00710
00711 uint32_t crystid = eeid.rawId();
00712 eeSimMap[crystid] += hitItr->energy();
00713 }
00714 }
00715
00716
00717 const EEDigiCollection *endcapDigi = EcalDigiEE.product();
00718
00719 std::vector<double> eeAnalogSignal;
00720 std::vector<double> eeADCCounts;
00721 std::vector<double> eeADCGains;
00722 eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
00723 eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
00724 eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
00725
00726 int inc = 0;
00727 for (unsigned int digis=0; digis<EcalDigiEE->size(); ++digis){
00728
00729 ++inc;
00730
00731 EEDataFrame eedf = (*endcapDigi)[digis];
00732 int nrSamples = eedf.size();
00733
00734 EEDetId eeid = eedf.id () ;
00735
00736 double Emax = 0;
00737 int Pmax = 0;
00738 double pedestalPreSample = 0.;
00739 double pedestalPreSampleAnalog = 0.;
00740
00741 for (int sample = 0 ; sample < nrSamples; ++sample) {
00742 eeAnalogSignal[sample] = 0.;
00743 eeADCCounts[sample] = 0.;
00744 eeADCGains[sample] = -1.;
00745 }
00746
00747
00748 for (int sample = 0 ; sample < nrSamples; ++sample) {
00749
00750 EcalMGPASample thisSample = eedf[sample];
00751
00752 eeADCCounts[sample] = (thisSample.adc());
00753 eeADCGains[sample] = (thisSample.gainId());
00754 eeAnalogSignal[sample] =
00755 (eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
00756 * ECalbarrelADCtoGeV_);
00757 if (Emax < eeAnalogSignal[sample]) {
00758 Emax = eeAnalogSignal[sample];
00759 Pmax = sample;
00760 }
00761 if ( sample < 3 ) {
00762 pedestalPreSample += eeADCCounts[sample] ;
00763 pedestalPreSampleAnalog +=
00764 eeADCCounts[sample] * ECalgainConv_[(int)eeADCGains[sample]]
00765 * ECalbarrelADCtoGeV_ ;
00766 }
00767
00768 }
00769 pedestalPreSample /= 3. ;
00770 pedestalPreSampleAnalog /= 3. ;
00771
00772
00773 double Erec = Emax - pedestalPreSampleAnalog
00774 * ECalgainConv_[(int)eeADCGains[Pmax]];
00775
00776
00777 mehEcalMaxPos[1]->Fill(Pmax);
00778 mehEcalSHE[1]->Fill(eeSimMap[eeid.rawId()]);
00779 mehEcalAEE[1]->Fill(Erec);
00780
00781 if (eeSimMap[eeid.rawId()]!=0){
00782 mehEcalSHEvAEESHE[1]->Fill(Erec/eeSimMap[eeid.rawId()],
00783 eeSimMap[eeid.rawId()]);
00784 }
00785
00786
00787
00788 mehEcalMultvAEE[1]->Fill(Pmax,(float)inc);
00789
00790 }
00791
00792 if (verbosity > 1) {
00793 eventout += "\n Number of EEDigis collected:.............. ";
00794 eventout += inc;
00795 }
00796
00797 mehEcaln[1]->Fill((float)inc);
00798 }
00799 }
00800
00802
00804 bool isPreshower = true;
00805 edm::Handle<ESDigiCollection> EcalDigiES;
00806 iEvent.getByLabel(ECalESSrc_, EcalDigiES);
00807 bool validDigiES = true;
00808 if (!EcalDigiES.isValid()) {
00809 LogDebug(MsgLoggerCat)
00810 << "Unable to find EcalDigiES in event!";
00811 validDigiES = false;
00812 }
00813
00814
00815 validDigiES = false;
00816
00817 if (validDigiES) {
00818 if (EcalDigiES->size() == 0) isPreshower = false;
00819
00820 if (isPreshower) {
00821
00822
00823 const std::string preshowerHitsName(hitsProducer+"EcalHitsES");
00824 iEvent.getByLabel("mix",preshowerHitsName,crossingFrame);
00825 bool validXFrame = true;
00826 if (!crossingFrame.isValid()) {
00827 LogDebug(MsgLoggerCat)
00828 << "Unable to find cal preshower crossingFrame in event!";
00829 validXFrame = false;
00830 }
00831 if (validXFrame) {
00832 std::auto_ptr<MixCollection<PCaloHit> >
00833 preshowerHits(new MixCollection<PCaloHit>(crossingFrame.product()));
00834
00835
00836 MapType esSimMap;
00837 for (MixCollection<PCaloHit>::MixItr hitItr
00838 = preshowerHits->begin();
00839 hitItr != preshowerHits->end();
00840 ++hitItr) {
00841
00842 ESDetId esid = ESDetId(hitItr->id());
00843
00844 uint32_t crystid = esid.rawId();
00845 esSimMap[crystid] += hitItr->energy();
00846 }
00847 }
00848
00849
00850 const ESDigiCollection *preshowerDigi = EcalDigiES.product();
00851
00852 std::vector<double> esADCCounts;
00853 esADCCounts.reserve(ESDataFrame::MAXSAMPLES);
00854
00855 int i = 0;
00856 for (unsigned int digis=0; digis<EcalDigiES->size(); ++digis) {
00857
00858 ++i;
00859
00860
00861 ESDataFrame esdf = (*preshowerDigi)[digis];
00862 int nrSamples = esdf.size();
00863
00864 for (int sample = 0 ; sample < nrSamples; ++sample) {
00865 esADCCounts[sample] = 0.;
00866 }
00867
00868
00869 for (int sample = 0 ; sample < nrSamples; ++sample) {
00870
00871 ESSample thisSample = esdf[sample];
00872 esADCCounts[sample] = (thisSample.adc());
00873 }
00874
00875 mehEScalADC[0]->Fill(esADCCounts[0]);
00876 mehEScalADC[1]->Fill(esADCCounts[1]);
00877 mehEScalADC[2]->Fill(esADCCounts[2]);
00878
00879 }
00880
00881 if (verbosity > 1) {
00882 eventout += "\n Number of ESDigis collected:.............. ";
00883 eventout += i;
00884 }
00885
00886 mehEScaln->Fill((float)i);
00887 }
00888 }
00889 if (verbosity > 0)
00890 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
00891
00892 return;
00893 }
00894
00895
00896 void GlobalDigisAnalyzer::fillHCal(const edm::Event& iEvent,
00897 const edm::EventSetup& iSetup)
00898 {
00899 std::string MsgLoggerCat = "GlobalDigisAnalyzer_fillHCal";
00900
00901 TString eventout;
00902 if (verbosity > 0)
00903 eventout = "\nGathering info:";
00904
00905
00906 edm::ESHandle<HcalDbService> HCalconditions;
00907 iSetup.get<HcalDbRecord>().get(HCalconditions);
00908 if (!HCalconditions.isValid()) {
00909 edm::LogWarning(MsgLoggerCat)
00910 << "Unable to find HCalconditions in event!";
00911 return;
00912 }
00913
00914 CaloSamples tool;
00915
00917
00919 edm::Handle<edm::PCaloHitContainer> hcalHits;
00920 iEvent.getByLabel(HCalSrc_,hcalHits);
00921 bool validhcalHits = true;
00922 if (!hcalHits.isValid()) {
00923 LogDebug(MsgLoggerCat)
00924 << "Unable to find hcalHits in event!";
00925 validhcalHits = false;
00926 }
00927 MapType fHBEnergySimHits;
00928 MapType fHEEnergySimHits;
00929 MapType fHOEnergySimHits;
00930 MapType fHFEnergySimHits;
00931 if (validhcalHits) {
00932 const edm::PCaloHitContainer *simhitResult = hcalHits.product();
00933
00934 for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin();
00935 simhits != simhitResult->end();
00936 ++simhits) {
00937
00938 HcalDetId detId(simhits->id());
00939 uint32_t cellid = detId.rawId();
00940
00941 if (detId.subdet() == sdHcalBrl){
00942 fHBEnergySimHits[cellid] += simhits->energy();
00943 }
00944 if (detId.subdet() == sdHcalEC){
00945 fHEEnergySimHits[cellid] += simhits->energy();
00946 }
00947 if (detId.subdet() == sdHcalOut){
00948 fHOEnergySimHits[cellid] += simhits->energy();
00949 }
00950 if (detId.subdet() == sdHcalFwd){
00951 fHFEnergySimHits[cellid] += simhits->energy();
00952 }
00953 }
00954 }
00955
00957
00959 edm::Handle<edm::SortedCollection<HBHEDataFrame> > hbhe;
00960 iEvent.getByLabel(HCalDigi_,hbhe);
00961 bool validHBHE = true;
00962 if (!hbhe.isValid()) {
00963 LogDebug(MsgLoggerCat)
00964 << "Unable to find HBHEDataFrame in event!";
00965 validHBHE = false;
00966 }
00967
00968 if (validHBHE) {
00969 edm::SortedCollection<HBHEDataFrame>::const_iterator ihbhe;
00970
00971 int iHB = 0;
00972 int iHE = 0;
00973 for (ihbhe = hbhe->begin(); ihbhe != hbhe->end(); ++ihbhe) {
00974 HcalDetId cell(ihbhe->id());
00975
00976 if ((cell.subdet() == sdHcalBrl) || (cell.subdet() == sdHcalEC)) {
00977
00978
00979 const HcalCalibrations& calibrations =
00980 HCalconditions->getHcalCalibrations(cell);
00981 const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
00982 const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
00983 HcalCoderDb coder(*channelCoder, *shape);
00984 coder.adc2fC(*ihbhe, tool);
00985
00986
00987 if (cell.subdet() == sdHcalBrl) {
00988
00989 ++iHB;
00990 float fDigiSum = 0.0;
00991 for (int ii = 0; ii < tool.size(); ++ii) {
00992
00993 int capid = (*ihbhe)[ii].capid();
00994 fDigiSum += (tool[ii] - calibrations.pedestal(capid));
00995 }
00996
00997 mehHcalSHE[0]->Fill(fHFEnergySimHits[cell.rawId()]);
00998 mehHcalAEE[0]->Fill(fDigiSum);
00999
01000 if (fHFEnergySimHits[cell.rawId()]!=0){
01001 mehHcalAEESHE[0]->Fill(fDigiSum/fHFEnergySimHits[cell.rawId()]);
01002 }
01003
01004
01005
01006 mehHcalSHEvAEE[0]->Fill(fDigiSum, fHFEnergySimHits[cell.rawId()]);
01007 }
01008
01009
01010 if (cell.subdet() == sdHcalEC) {
01011
01012 ++iHE;
01013 float fDigiSum = 0.0;
01014 for (int ii = 0; ii < tool.size(); ++ii) {
01015 int capid = (*ihbhe)[ii].capid();
01016 fDigiSum += (tool[ii]-calibrations.pedestal(capid));
01017 }
01018
01019 mehHcalSHE[1]->Fill(fHFEnergySimHits[cell.rawId()]);
01020 mehHcalAEE[1]->Fill(fDigiSum);
01021
01022 if (fHFEnergySimHits[cell.rawId()]!=0){
01023 mehHcalAEESHE[1]->Fill(fDigiSum/fHFEnergySimHits[cell.rawId()]);
01024 }
01025
01026
01027
01028 mehHcalSHEvAEE[1]->Fill(fDigiSum, fHFEnergySimHits[cell.rawId()]);
01029 }
01030 }
01031 }
01032
01033 if (verbosity > 1) {
01034 eventout += "\n Number of HBDigis collected:.............. ";
01035 eventout += iHB;
01036 }
01037 mehHcaln[0]->Fill((float)iHB);
01038
01039 if (verbosity > 1) {
01040 eventout += "\n Number of HEDigis collected:.............. ";
01041 eventout += iHE;
01042 }
01043 mehHcaln[1]->Fill((float)iHE);
01044 }
01045
01047
01049 edm::Handle<edm::SortedCollection<HODataFrame> > ho;
01050 iEvent.getByLabel(HCalDigi_,ho);
01051 bool validHO = true;
01052 if (!ho.isValid()) {
01053 LogDebug(MsgLoggerCat)
01054 << "Unable to find HODataFrame in event!";
01055 validHO = false;
01056 }
01057 if (validHO) {
01058 edm::SortedCollection<HODataFrame>::const_iterator iho;
01059
01060 int iHO = 0;
01061 for (iho = ho->begin(); iho != ho->end(); ++iho) {
01062 HcalDetId cell(iho->id());
01063
01064 if (cell.subdet() == sdHcalOut) {
01065
01066
01067 const HcalCalibrations& calibrations =
01068 HCalconditions->getHcalCalibrations(cell);
01069 const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
01070 const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
01071 HcalCoderDb coder (*channelCoder, *shape);
01072 coder.adc2fC(*iho, tool);
01073
01074 ++iHO;
01075 float fDigiSum = 0.0;
01076 for (int ii = 0; ii < tool.size(); ++ii) {
01077
01078 int capid = (*iho)[ii].capid();
01079 fDigiSum += (tool[ii] - calibrations.pedestal(capid));
01080 }
01081
01082 mehHcalSHE[2]->Fill(fHFEnergySimHits[cell.rawId()]);
01083 mehHcalAEE[2]->Fill(fDigiSum);
01084
01085 if (fHFEnergySimHits[cell.rawId()]!=0){
01086 mehHcalAEESHE[2]->Fill(fDigiSum/fHFEnergySimHits[cell.rawId()]);
01087 }
01088
01089
01090
01091 mehHcalSHEvAEE[2]->Fill(fDigiSum, fHFEnergySimHits[cell.rawId()]);
01092 }
01093 }
01094
01095 if (verbosity > 1) {
01096 eventout += "\n Number of HODigis collected:.............. ";
01097 eventout += iHO;
01098 }
01099 mehHcaln[2]->Fill((float)iHO);
01100 }
01101
01103
01105 edm::Handle<edm::SortedCollection<HFDataFrame> > hf;
01106 iEvent.getByLabel(HCalDigi_,hf);
01107 bool validHF = true;
01108 if (!hf.isValid()) {
01109 LogDebug(MsgLoggerCat)
01110 << "Unable to find HFDataFrame in event!";
01111 validHF = false;
01112 }
01113 if (validHF) {
01114 edm::SortedCollection<HFDataFrame>::const_iterator ihf;
01115
01116 int iHF = 0;
01117 for (ihf = hf->begin(); ihf != hf->end(); ++ihf) {
01118 HcalDetId cell(ihf->id());
01119
01120 if (cell.subdet() == sdHcalFwd) {
01121
01122
01123 const HcalCalibrations& calibrations =
01124 HCalconditions->getHcalCalibrations(cell);
01125 const HcalQIECoder *channelCoder = HCalconditions->getHcalCoder(cell);
01126 const HcalQIEShape *shape = HCalconditions->getHcalShape(channelCoder);
01127 HcalCoderDb coder (*channelCoder, *shape);
01128 coder.adc2fC(*ihf, tool);
01129
01130 ++iHF;
01131 float fDigiSum = 0.0;
01132 for (int ii = 0; ii < tool.size(); ++ii) {
01133
01134 int capid = (*ihf)[ii].capid();
01135 fDigiSum += (tool[ii] - calibrations.pedestal(capid));
01136 }
01137
01138 mehHcalSHE[3]->Fill(fHFEnergySimHits[cell.rawId()]);
01139 mehHcalAEE[3]->Fill(fDigiSum);
01140
01141 if (fHFEnergySimHits[cell.rawId()]!=0){
01142 mehHcalAEESHE[3]->Fill(fDigiSum/fHFEnergySimHits[cell.rawId()]);
01143 }
01144
01145
01146
01147 mehHcalSHEvAEE[3]->Fill(fDigiSum, fHFEnergySimHits[cell.rawId()]);
01148 }
01149 }
01150
01151 if (verbosity > 1) {
01152 eventout += "\n Number of HFDigis collected:.............. ";
01153 eventout += iHF;
01154 }
01155 mehHcaln[3]->Fill((float)iHF);
01156 }
01157
01158 if (verbosity > 0)
01159 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01160
01161 return;
01162 }
01163
01164 void GlobalDigisAnalyzer::fillTrk(const edm::Event& iEvent,
01165 const edm::EventSetup& iSetup)
01166 {
01167 std::string MsgLoggerCat = "GlobalDigisAnalyzer_fillTrk";
01168
01169 TString eventout;
01170 if (verbosity > 0)
01171 eventout = "\nGathering info:";
01172
01173
01174 edm::Handle<edm::DetSetVector<SiStripDigi> > stripDigis;
01175 iEvent.getByLabel(SiStripSrc_, stripDigis);
01176 bool validstripDigis = true;
01177 if (!stripDigis.isValid()) {
01178 LogDebug(MsgLoggerCat)
01179 << "Unable to find stripDigis in event!";
01180 validstripDigis = false;
01181 }
01182
01183 if (validstripDigis) {
01184 int nStripBrl = 0, nStripFwd = 0;
01185 edm::DetSetVector<SiStripDigi>::const_iterator DSViter;
01186 for (DSViter = stripDigis->begin(); DSViter != stripDigis->end();
01187 ++DSViter) {
01188 unsigned int id = DSViter->id;
01189 DetId detId(id);
01190 edm::DetSet<SiStripDigi>::const_iterator begin = DSViter->data.begin();
01191 edm::DetSet<SiStripDigi>::const_iterator end = DSViter->data.end();
01192 edm::DetSet<SiStripDigi>::const_iterator iter;
01193
01194
01195 if (detId.subdetId() == sdSiTIB) {
01196 TIBDetId tibid(id);
01197 for (iter = begin; iter != end; ++iter) {
01198 ++nStripBrl;
01199 if (tibid.layer() == 1) {
01200 mehSiStripADC[0]->Fill((*iter).adc());
01201 mehSiStripStrip[0]->Fill((*iter).strip());
01202 }
01203 if (tibid.layer() == 2) {
01204 mehSiStripADC[1]->Fill((*iter).adc());
01205 mehSiStripStrip[1]->Fill((*iter).strip());
01206 }
01207 if (tibid.layer() == 3) {
01208 mehSiStripADC[2]->Fill((*iter).adc());
01209 mehSiStripStrip[2]->Fill((*iter).strip());
01210 }
01211 if (tibid.layer() == 4) {
01212 mehSiStripADC[3]->Fill((*iter).adc());
01213 mehSiStripStrip[3]->Fill((*iter).strip());
01214 }
01215 }
01216 }
01217
01218
01219 if (detId.subdetId() == sdSiTOB) {
01220 TOBDetId tobid(id);
01221 for (iter = begin; iter != end; ++iter) {
01222 ++nStripBrl;
01223 if (tobid.layer() == 1) {
01224 mehSiStripADC[4]->Fill((*iter).adc());
01225 mehSiStripStrip[4]->Fill((*iter).strip());
01226 }
01227 if (tobid.layer() == 2) {
01228 mehSiStripADC[5]->Fill((*iter).adc());
01229 mehSiStripStrip[5]->Fill((*iter).strip());
01230 }
01231 if (tobid.layer() == 3) {
01232 mehSiStripADC[6]->Fill((*iter).adc());
01233 mehSiStripStrip[6]->Fill((*iter).strip());
01234 }
01235 if (tobid.layer() == 4) {
01236 mehSiStripADC[7]->Fill((*iter).adc());
01237 mehSiStripStrip[7]->Fill((*iter).strip());
01238 }
01239 }
01240 }
01241
01242
01243 if (detId.subdetId() == sdSiTID) {
01244 TIDDetId tidid(id);
01245 for (iter = begin; iter != end; ++iter) {
01246 ++nStripFwd;
01247 if (tidid.wheel() == 1) {
01248 mehSiStripADC[8]->Fill((*iter).adc());
01249 mehSiStripStrip[8]->Fill((*iter).strip());
01250 }
01251 if (tidid.wheel() == 2) {
01252 mehSiStripADC[9]->Fill((*iter).adc());
01253 mehSiStripStrip[9]->Fill((*iter).strip());
01254 }
01255 if (tidid.wheel() == 3) {
01256 mehSiStripADC[10]->Fill((*iter).adc());
01257 mehSiStripStrip[10]->Fill((*iter).strip());
01258 }
01259 }
01260 }
01261
01262
01263 if (detId.subdetId() == sdSiTEC) {
01264 TECDetId tecid(id);
01265 for (iter = begin; iter != end; ++iter) {
01266 ++nStripFwd;
01267 if (tecid.wheel() == 1) {
01268 mehSiStripADC[11]->Fill((*iter).adc());
01269 mehSiStripStrip[11]->Fill((*iter).strip());
01270 }
01271 if (tecid.wheel() == 2) {
01272 mehSiStripADC[12]->Fill((*iter).adc());
01273 mehSiStripStrip[12]->Fill((*iter).strip());
01274 }
01275 if (tecid.wheel() == 3) {
01276 mehSiStripADC[13]->Fill((*iter).adc());
01277 mehSiStripStrip[13]->Fill((*iter).strip());
01278 }
01279 if (tecid.wheel() == 4) {
01280 mehSiStripADC[14]->Fill((*iter).adc());
01281 mehSiStripStrip[14]->Fill((*iter).strip());
01282 }
01283 if (tecid.wheel() == 5) {
01284 mehSiStripADC[15]->Fill((*iter).adc());
01285 mehSiStripStrip[15]->Fill((*iter).strip());
01286 }
01287 if (tecid.wheel() == 6) {
01288 mehSiStripADC[16]->Fill((*iter).adc());
01289 mehSiStripStrip[16]->Fill((*iter).strip());
01290 }
01291 if (tecid.wheel() == 7) {
01292 mehSiStripADC[17]->Fill((*iter).adc());
01293 mehSiStripStrip[17]->Fill((*iter).strip());
01294 }
01295 if (tecid.wheel() == 8) {
01296 mehSiStripADC[18]->Fill((*iter).adc());
01297 mehSiStripStrip[18]->Fill((*iter).strip());
01298 }
01299 }
01300 }
01301 }
01302
01303 if (verbosity > 1) {
01304 eventout += "\n Number of BrlStripDigis collected:........ ";
01305 eventout += nStripBrl;
01306 }
01307 for(int i = 0; i < 8; ++i) {
01308 mehSiStripn[i]->Fill((float)nStripBrl);
01309 }
01310
01311 if (verbosity > 1) {
01312 eventout += "\n Number of FrwdStripDigis collected:....... ";
01313 eventout += nStripFwd;
01314 }
01315 for(int i = 8; i < 19; ++i) {
01316 mehSiStripn[i]->Fill((float)nStripFwd);
01317 }
01318 }
01319
01320
01321 edm::Handle<edm::DetSetVector<PixelDigi> > pixelDigis;
01322 iEvent.getByLabel(SiPxlSrc_, pixelDigis);
01323 bool validpixelDigis = true;
01324 if (!pixelDigis.isValid()) {
01325 LogDebug(MsgLoggerCat)
01326 << "Unable to find pixelDigis in event!";
01327 validpixelDigis = false;
01328 }
01329 if (validpixelDigis) {
01330 int nPxlBrl = 0, nPxlFwd = 0;
01331 edm::DetSetVector<PixelDigi>::const_iterator DPViter;
01332 for (DPViter = pixelDigis->begin(); DPViter != pixelDigis->end();
01333 ++DPViter) {
01334 unsigned int id = DPViter->id;
01335 DetId detId(id);
01336 edm::DetSet<PixelDigi>::const_iterator begin = DPViter->data.begin();
01337 edm::DetSet<PixelDigi>::const_iterator end = DPViter->data.end();
01338 edm::DetSet<PixelDigi>::const_iterator iter;
01339
01340
01341 if (detId.subdetId() == sdPxlBrl) {
01342 PXBDetId bdetid(id);
01343 for (iter = begin; iter != end; ++iter) {
01344 ++nPxlBrl;
01345 if (bdetid.layer() == 1) {
01346 mehSiPixelADC[0]->Fill((*iter).adc());
01347 mehSiPixelRow[0]->Fill((*iter).row());
01348 mehSiPixelCol[0]->Fill((*iter).column());
01349 }
01350 if (bdetid.layer() == 2) {
01351 mehSiPixelADC[1]->Fill((*iter).adc());
01352 mehSiPixelRow[1]->Fill((*iter).row());
01353 mehSiPixelCol[1]->Fill((*iter).column());
01354 }
01355 if (bdetid.layer() == 3) {
01356 mehSiPixelADC[2]->Fill((*iter).adc());
01357 mehSiPixelRow[2]->Fill((*iter).row());
01358 mehSiPixelCol[2]->Fill((*iter).column());
01359 }
01360 }
01361 }
01362
01363
01364 if (detId.subdetId() == sdPxlFwd) {
01365 PXFDetId fdetid(id);
01366 for (iter = begin; iter != end; ++iter) {
01367 ++nPxlFwd;
01368 if (fdetid.disk() == 1) {
01369 if (fdetid.side() == 1) {
01370 mehSiPixelADC[4]->Fill((*iter).adc());
01371 mehSiPixelRow[4]->Fill((*iter).row());
01372 mehSiPixelCol[4]->Fill((*iter).column());
01373 }
01374 if (fdetid.side() == 2) {
01375 mehSiPixelADC[3]->Fill((*iter).adc());
01376 mehSiPixelRow[3]->Fill((*iter).row());
01377 mehSiPixelCol[3]->Fill((*iter).column());
01378 }
01379 }
01380 if (fdetid.disk() == 2) {
01381 if (fdetid.side() == 1) {
01382
01383 mehSiPixelADC[6]->Fill((*iter).adc());
01384 mehSiPixelRow[6]->Fill((*iter).row());
01385 mehSiPixelCol[6]->Fill((*iter).column());
01386 }
01387 if (fdetid.side() == 2) {
01388 mehSiPixelADC[5]->Fill((*iter).adc());
01389 mehSiPixelRow[5]->Fill((*iter).row());
01390 mehSiPixelCol[5]->Fill((*iter).column());
01391 }
01392 }
01393 }
01394 }
01395 }
01396
01397 if (verbosity > 1) {
01398 eventout += "\n Number of BrlPixelDigis collected:........ ";
01399 eventout += nPxlBrl;
01400 }
01401 for(int i = 0; i < 3; ++i) {
01402 mehSiPixeln[i]->Fill((float)nPxlBrl);
01403 }
01404
01405 if (verbosity > 1) {
01406 eventout += "\n Number of FrwdPixelDigis collected:....... ";
01407 eventout += nPxlFwd;
01408 }
01409
01410 for(int i = 3; i < 7; ++i) {
01411 mehSiPixeln[i]->Fill((float)nPxlFwd);
01412 }
01413 }
01414
01415 if (verbosity > 0)
01416 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01417
01418 return;
01419 }
01420
01421 void GlobalDigisAnalyzer::fillMuon(const edm::Event& iEvent,
01422 const edm::EventSetup& iSetup)
01423 {
01424 std::string MsgLoggerCat = "GlobalDigisAnalyzer_fillMuon";
01425
01426 TString eventout;
01427 if (verbosity > 0)
01428 eventout = "\nGathering info:";
01429
01430
01431 edm::Handle<DTDigiCollection> dtDigis;
01432 iEvent.getByLabel(MuDTSrc_, dtDigis);
01433 bool validdtDigis = true;
01434 if (!dtDigis.isValid()) {
01435 LogDebug(MsgLoggerCat)
01436 << "Unable to find dtDigis in event!";
01437 validdtDigis = false;
01438 }
01439 if (validdtDigis) {
01440 int nDt0 = 0; int nDt1 = 0; int nDt2 = 0; int nDt3 = 0;
01441 int nDt = 0;
01442 DTDigiCollection::DigiRangeIterator detUnitIt;
01443 for (detUnitIt = dtDigis->begin(); detUnitIt != dtDigis->end();
01444 ++detUnitIt) {
01445
01446 const DTLayerId& id = (*detUnitIt).first;
01447 const DTDigiCollection::Range& range = (*detUnitIt).second;
01448 for (DTDigiCollection::const_iterator digiIt = range.first;
01449 digiIt != range.second;
01450 ++digiIt) {
01451
01452 ++nDt;
01453
01454 DTWireId wireId(id,(*digiIt).wire());
01455 if (wireId.station() == 1) {
01456 mehDtMuonLayer[0]->Fill(id.layer());
01457 mehDtMuonTime[0]->Fill((*digiIt).time());
01458 mehDtMuonTimevLayer[0]->Fill(id.layer(),(*digiIt).time());
01459 ++nDt0;
01460 }
01461 if (wireId.station() == 2) {
01462 mehDtMuonLayer[1]->Fill(id.layer());
01463 mehDtMuonTime[1]->Fill((*digiIt).time());
01464 mehDtMuonTimevLayer[1]->Fill(id.layer(),(*digiIt).time());
01465 ++nDt1;
01466 }
01467 if (wireId.station() == 3) {
01468 mehDtMuonLayer[2]->Fill(id.layer());
01469 mehDtMuonTime[2]->Fill((*digiIt).time());
01470 mehDtMuonTimevLayer[2]->Fill(id.layer(),(*digiIt).time());
01471 ++nDt2;
01472 }
01473 if (wireId.station() == 4) {
01474 mehDtMuonLayer[3]->Fill(id.layer());
01475 mehDtMuonTime[3]->Fill((*digiIt).time());
01476 mehDtMuonTimevLayer[3]->Fill(id.layer(),(*digiIt).time());
01477 ++nDt3;
01478 }
01479 }
01480 }
01481 mehDtMuonn[0]->Fill((float)nDt0);
01482 mehDtMuonn[1]->Fill((float)nDt1);
01483 mehDtMuonn[2]->Fill((float)nDt2);
01484 mehDtMuonn[3]->Fill((float)nDt3);
01485
01486
01487 if (verbosity > 1) {
01488 eventout += "\n Number of DtMuonDigis collected:.......... ";
01489 eventout += nDt;
01490 }
01491 }
01492
01493
01494 edm::Handle<CSCStripDigiCollection> strips;
01495 iEvent.getByLabel(MuCSCStripSrc_, strips);
01496 bool validstrips = true;
01497 if (!strips.isValid()) {
01498 LogDebug(MsgLoggerCat)
01499 << "Unable to find muon strips in event!";
01500 validstrips = false;
01501 }
01502
01503 if (validstrips) {
01504 int nStrips = 0;
01505 for (CSCStripDigiCollection::DigiRangeIterator j = strips->begin();
01506 j != strips->end();
01507 ++j) {
01508
01509 std::vector<CSCStripDigi>::const_iterator digiItr = (*j).second.first;
01510 std::vector<CSCStripDigi>::const_iterator last = (*j).second.second;
01511
01512 for ( ; digiItr != last; ++digiItr) {
01513 ++nStrips;
01514
01515
01516 std::vector<int> adcCounts = digiItr->getADCCounts();
01517 theCSCStripPedestalSum += adcCounts[0];
01518 theCSCStripPedestalSum += adcCounts[1];
01519 theCSCStripPedestalCount += 2;
01520
01521
01522 if (theCSCStripPedestalCount > 100) {
01523 float pedestal = theCSCStripPedestalSum / theCSCStripPedestalCount;
01524 if (adcCounts[5] > (pedestal + 100))
01525 mehCSCStripADC->Fill(adcCounts[4] - pedestal);
01526 }
01527 }
01528 }
01529
01530 if (verbosity > 1) {
01531 eventout += "\n Number of CSCStripDigis collected:........ ";
01532 eventout += nStrips;
01533 }
01534 mehCSCStripn->Fill((float)nStrips);
01535 }
01536
01537
01538 edm::Handle<CSCWireDigiCollection> wires;
01539 iEvent.getByLabel(MuCSCWireSrc_, wires);
01540 bool validwires = true;
01541 if (!wires.isValid()) {
01542 LogDebug(MsgLoggerCat)
01543 << "Unable to find muon wires in event!";
01544 validwires = false;
01545 }
01546
01547 if (validwires) {
01548 int nWires = 0;
01549 for (CSCWireDigiCollection::DigiRangeIterator j = wires->begin();
01550 j != wires->end();
01551 ++j) {
01552
01553 std::vector<CSCWireDigi>::const_iterator digiItr = (*j).second.first;
01554 std::vector<CSCWireDigi>::const_iterator endDigi = (*j).second.second;
01555
01556 for ( ; digiItr != endDigi; ++digiItr) {
01557 ++nWires;
01558 mehCSCWireTime->Fill(digiItr->getTimeBin());
01559 }
01560 }
01561
01562 if (verbosity > 1) {
01563 eventout += "\n Number of CSCWireDigis collected:......... ";
01564 eventout += nWires;
01565 }
01566 mehCSCWiren->Fill((float)nWires);
01567 }
01568
01569
01570
01571 edm::ESHandle<RPCGeometry> rpcGeom;
01572 iSetup.get<MuonGeometryRecord>().get(rpcGeom);
01573 if (!rpcGeom.isValid()) {
01574 edm::LogWarning(MsgLoggerCat)
01575 << "Unable to find RPCGeometryRecord in event!";
01576 return;
01577 }
01578
01579 edm::Handle<edm::PSimHitContainer> rpcsimHit;
01580 iEvent.getByLabel("g4SimHits", "MuonRPCHits", rpcsimHit);
01581 bool validrpcsim = true;
01582 if (!rpcsimHit.isValid()) {
01583 LogDebug(MsgLoggerCat)
01584 << "Unable to find rpcsimHit in event!";
01585 validrpcsim = false;
01586 }
01587
01588 edm::Handle<RPCDigiCollection> rpcDigis;
01589 iEvent.getByLabel(MuRPCSrc_, rpcDigis);
01590 bool validrpcdigi = true;
01591 if (!rpcDigis.isValid()) {
01592 LogDebug(MsgLoggerCat)
01593 << "Unable to find rpcDigis in event!";
01594 validrpcdigi = false;
01595 }
01596
01597
01598 validrpcdigi = false;
01599
01600
01601 edm::PSimHitContainer::const_iterator rpcsimIt;
01602 std::map<RPCDetId, std::vector<double> > allsims;
01603
01604 if (validrpcsim) {
01605 for (rpcsimIt = rpcsimHit->begin(); rpcsimIt != rpcsimHit->end();
01606 rpcsimIt++) {
01607 RPCDetId Rsid = (RPCDetId)(*rpcsimIt).detUnitId();
01608 int ptype = rpcsimIt->particleType();
01609
01610 if (ptype == 13 || ptype == -13) {
01611 std::vector<double> buff;
01612 if (allsims.find(Rsid) != allsims.end() ){
01613 buff= allsims[Rsid];
01614 }
01615 buff.push_back(rpcsimIt->localPosition().x());
01616 allsims[Rsid]=buff;
01617 }
01618 }
01619 }
01620
01621
01622
01623 if (validrpcdigi) {
01624 int nRPC = 0;
01625 RPCDigiCollection::DigiRangeIterator rpcdetUnitIt;
01626 for (rpcdetUnitIt = rpcDigis->begin(); rpcdetUnitIt != rpcDigis->end();
01627 ++rpcdetUnitIt) {
01628
01629 const RPCDetId Rsid = (*rpcdetUnitIt).first;
01630 const RPCRoll* roll =
01631 dynamic_cast<const RPCRoll* >( rpcGeom->roll(Rsid));
01632 const RPCDigiCollection::Range& range = (*rpcdetUnitIt).second;
01633
01634 std::vector<double> sims;
01635 if (allsims.find(Rsid) != allsims.end() ){
01636 sims = allsims[Rsid];
01637 }
01638
01639 int ndigi = 0;
01640 for (RPCDigiCollection::const_iterator rpcdigiIt = range.first;
01641 rpcdigiIt != range.second;
01642 ++rpcdigiIt) {
01643
01644 ++ndigi;
01645 ++nRPC;
01646 }
01647
01648 if (sims.size() == 1 && ndigi == 1){
01649 double dis = roll->centreOfStrip(range.first->strip()).x()-sims[0];
01650
01651 if (Rsid.region() == 0 ){
01652 if (Rsid.ring() == -2)
01653 mehRPCRes[0]->Fill((float)dis);
01654 else if (Rsid.ring() == -1)
01655 mehRPCRes[1]->Fill((float)dis);
01656 else if (Rsid.ring() == 0)
01657 mehRPCRes[2]->Fill((float)dis);
01658 else if (Rsid.ring() == 1)
01659 mehRPCRes[3]->Fill((float)dis);
01660 else if (Rsid.ring() == 2)
01661 mehRPCRes[4]->Fill((float)dis);
01662 }
01663 }
01664 }
01665
01666 if (verbosity > 1) {
01667 eventout += "\n Number of RPCDigis collected:.............. ";
01668 eventout += nRPC;
01669 }
01670 mehRPCMuonn->Fill(float(nRPC));
01671 }
01672
01673 if (verbosity > 0)
01674 edm::LogInfo(MsgLoggerCat) << eventout << "\n";
01675
01676 return;
01677 }