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