00001
00002 #include <memory>
00003
00004
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012
00013 #include "FWCore/ServiceRegistry/interface/Service.h"
00014
00015 #include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
00016 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00017 #include "DataFormats/Common/interface/DetSetVector.h"
00018 #include "DataFormats/Common/interface/DetSetVectorNew.h"
00019
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021 #include "DQMServices/Core/interface/MonitorElement.h"
00022
00023 #include "TH1F.h"
00024 #include "TFile.h"
00025 #include "TCanvas.h"
00026 #include "TH1.h"
00027 #include "TH2F.h"
00028 #include "TH1D.h"
00029 #include "TProfile.h"
00030 #include "TStyle.h"
00031 #include "TTree.h"
00032
00033 #include <sstream>
00034 #include <iostream>
00035 #include <vector>
00036
00037
00038
00039
00040
00041 class StripValidationPlots : public edm::EDAnalyzer {
00042 public:
00043 explicit StripValidationPlots(const edm::ParameterSet&);
00044 ~StripValidationPlots();
00045
00046
00047 private:
00048 virtual void beginJob() ;
00049 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00050 virtual void endJob() ;
00051
00052 std::ostringstream oss;
00053
00054 DQMStore* dqmStore_;
00055
00056 MonitorElement* tmp;
00057 TProfile* tmp_prof;
00058
00059
00060 std::vector<TH2F*> distanceVsStripNumber;
00061 std::vector<TProfile*> pfxDistanceVsStripNumber;
00062 std::vector<TH1F*> projXDistanceVsStripNumber;
00063 std::vector<TH1F*> projYDistanceVsStripNumber;
00064
00065 std::vector<TH2F*> occupancyVsStripNumber;
00066 std::vector<TProfile*> pfxOccupancyVsStripNumber;
00067 std::vector<TH1F*> projYOccupancyVsStripNumber;
00068 std::vector<TH2F*> occupancyHotStripsVsStripNumber;
00069 std::vector<TProfile*> pfxOccupancyHotStripsVsStripNumber;
00070 std::vector<TH1F*> projYOccupancyHotStripsVsStripNumber;
00071 std::vector<TH2F*> occupancyGoodStripsVsStripNumber;
00072 std::vector<TProfile*> pfxOccupancyGoodStripsVsStripNumber;
00073 std::vector<TH1F*> projYOccupancyGoodStripsVsStripNumber;
00074
00075 std::vector<TH2F*> poissonProbVsStripNumber;
00076 std::vector<TProfile*> pfxPoissonProbVsStripNumber;
00077 std::vector<TH1F*> projYPoissonProbVsStripNumber;
00078 std::vector<TH2F*> poissonProbHotStripsVsStripNumber;
00079 std::vector<TProfile*> pfxPoissonProbHotStripsVsStripNumber;
00080 std::vector<TH1F*> projYPoissonProbHotStripsVsStripNumber;
00081 std::vector<TH2F*> poissonProbGoodStripsVsStripNumber;
00082 std::vector<TProfile*> pfxPoissonProbGoodStripsVsStripNumber;
00083 std::vector<TH1F*> projYPoissonProbGoodStripsVsStripNumber;
00084
00085 std::vector<TH2F*> nHitsVsStripNumber;
00086 std::vector<TProfile*> pfxNHitsVsStripNumber;
00087 std::vector<TH1F*> projXNHitsVsStripNumber;
00088 std::vector<TH1F*> projYNHitsVsStripNumber;
00089 std::vector<TH2F*> nHitsHotStripsVsStripNumber;
00090 std::vector<TProfile*> pfxNHitsHotStripsVsStripNumber;
00091 std::vector<TH1F*> projXNHitsHotStripsVsStripNumber;
00092 std::vector<TH1F*> projYNHitsHotStripsVsStripNumber;
00093 std::vector<TH2F*> nHitsGoodStripsVsStripNumber;
00094 std::vector<TProfile*> pfxNHitsGoodStripsVsStripNumber;
00095 std::vector<TH1F*> projXNHitsGoodStripsVsStripNumber;
00096 std::vector<TH1F*> projYNHitsGoodStripsVsStripNumber;
00097
00098 std::vector<std::string> subDetName;
00099
00100 std::string infilename;
00101 std::string outfilename;
00102
00103 TFile* infile;
00104 TTree* intree;
00105
00106
00107 Int_t DetRawId;
00108 Int_t SubDetId;
00109 Int_t Layer_Ring;
00110 Int_t Disc;
00111 Int_t IsBack;
00112 Int_t IsExternalString;
00113 Int_t IsZMinusSide;
00114 Int_t RodStringPetal;
00115 Int_t IsStereo;
00116 Int_t ModulePosition;
00117 Int_t NumberOfStrips;
00118 Int_t StripNumber;
00119 Int_t APVChannel;
00120 Float_t StripGlobalPositionX;
00121 Float_t StripGlobalPositionY;
00122 Float_t StripGlobalPositionZ;
00123 Int_t IsHot;
00124 Int_t HotStripsPerAPV;
00125 Int_t HotStripsPerModule;
00126 Double_t StripOccupancy;
00127 Int_t StripHits;
00128 Double_t PoissonProb;
00129
00130
00131 Int_t savedDetRawId;
00132 Int_t savedNStrips;
00133 Int_t savedSubDetId;
00134 Int_t firstEntry;
00135 std::vector<unsigned int> vHotStripsInModule;
00136 unsigned int distance;
00137 unsigned int distanceR, distanceL;
00138 unsigned int nReadStrips[768][5];
00139
00140
00141 };
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 StripValidationPlots::StripValidationPlots(const edm::ParameterSet& iConfig) : infilename(iConfig.getUntrackedParameter<std::string>("inputFilename","in.root")),
00155 outfilename(iConfig.getUntrackedParameter<std::string>("outputFilename","out.root"))
00156
00157 {
00158
00159
00160 }
00161
00162
00163 StripValidationPlots::~StripValidationPlots()
00164 {
00165
00166
00167
00168
00169 }
00170
00171
00172
00173
00174
00175
00176
00177 void
00178 StripValidationPlots::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00179 {
00180
00181 }
00182
00183
00184
00185 void
00186 StripValidationPlots::beginJob()
00187 {
00188 oss.str("");
00189 oss << 1;
00190
00191 dqmStore_ = edm::Service<DQMStore>().operator->();
00192 dqmStore_->setCurrentFolder("ChannelStatusPlots");
00193
00194 for (int i=0; i<768; i++)
00195 {
00196 for (int j=0; j<5; j++)
00197 nReadStrips[i][j]=0;
00198 }
00199
00200
00201 subDetName.push_back(""); subDetName.push_back("TIB"); subDetName.push_back("TID"); subDetName.push_back("TOB"); subDetName.push_back("TEC");
00202 std::string histoName;
00203 std::string histoTitle;
00204 for(unsigned int i = 0; i < subDetName.size(); i++)
00205 {
00206 histoName = "distanceVsStripNumber" + subDetName[i];
00207 histoTitle = "Distance between hot strips vs. strip number";
00208 if(i!=0)
00209 histoTitle += " in " + subDetName[i];
00210 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 999, 0.5, 999.5);
00211 distanceVsStripNumber.push_back(tmp->getTH2F());
00212
00213 histoName = "pfxDistanceVsStripNumber" + subDetName[i];
00214 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00215 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00216 pfxDistanceVsStripNumber.push_back(tmp->getTProfile());
00217 pfxDistanceVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00218 pfxDistanceVsStripNumber[i]->GetYaxis()->SetTitle("Distance");
00219
00220 histoName = "projXDistanceVsStripNumber" + subDetName[i];
00221 histoTitle = "Number of hot strips vs. strip number";
00222 if(i!=0)
00223 histoTitle += " in " + subDetName[i];
00224 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00225 projXDistanceVsStripNumber.push_back(tmp->getTH1F());
00226 projXDistanceVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00227 projXDistanceVsStripNumber[i]->GetYaxis()->SetTitle("N_{hot}");
00228
00229 histoName = "projYDistanceVsStripNumber" + subDetName[i];
00230 histoTitle = "Distribution of distance between hot strips";
00231 if(i!=0)
00232 histoTitle += " in " + subDetName[i];
00233 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 999, 0.5, 999.5);
00234 projYDistanceVsStripNumber.push_back(tmp->getTH1F());
00235 projYDistanceVsStripNumber[i]->GetXaxis()->SetTitle("Distance");
00236 projYDistanceVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00237
00238
00239 histoName = "occupancyVsStripNumber" + subDetName[i];
00240 histoTitle = "Occupancy of strips vs. strip number";
00241 if(i!=0)
00242 histoTitle += " in " + subDetName[i];
00243 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -8.,0.);
00244 occupancyVsStripNumber.push_back(tmp->getTH2F());
00245
00246 histoName = "pfxOccupancyVsStripNumber" + subDetName[i];
00247 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00248 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00249 pfxOccupancyVsStripNumber.push_back(tmp->getTProfile());
00250 pfxOccupancyVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00251 pfxOccupancyVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Occupancy)");
00252
00253 histoName = "projYOccupancyVsStripNumber" + subDetName[i];
00254 histoTitle = "Distribution of strip occupancy";
00255 if(i!=0)
00256 histoTitle += " in " + subDetName[i];
00257 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -8., 0.);
00258 projYOccupancyVsStripNumber.push_back(tmp->getTH1F());
00259 projYOccupancyVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
00260 projYOccupancyVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00261
00262
00263 histoName = "occupancyHotStripsVsStripNumber" + subDetName[i];
00264 histoTitle = "Occupancy of hot strips vs. strip number";
00265 if(i!=0)
00266 histoTitle += " in " + subDetName[i];
00267 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -8., 0.);
00268 occupancyHotStripsVsStripNumber.push_back(tmp->getTH2F());
00269
00270 histoName = "pfxOccupancyHotStripsVsStripNumber" + subDetName[i];
00271 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00272 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00273 pfxOccupancyHotStripsVsStripNumber.push_back(tmp->getTProfile());
00274 pfxOccupancyHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00275 pfxOccupancyHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Occupancy)");
00276
00277 histoName = "projYOccupancyHotStripsVsStripNumber" + subDetName[i];
00278 histoTitle = "Distribution of hot strip occupancy";
00279 if(i!=0)
00280 histoTitle += " in " + subDetName[i];
00281 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -8., 0.);
00282 projYOccupancyHotStripsVsStripNumber.push_back(tmp->getTH1F());
00283 projYOccupancyHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
00284 projYOccupancyHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00285
00286
00287 histoName = "occupancyGoodStripsVsStripNumber" + subDetName[i];
00288 histoTitle = "Occupancy of good strips vs. strip number";
00289 if(i!=0)
00290 histoTitle += " in " + subDetName[i];
00291 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -8., 0.);
00292 occupancyGoodStripsVsStripNumber.push_back(tmp->getTH2F());
00293
00294 histoName = "pfxOccupancyGoodStripsVsStripNumber" + subDetName[i];
00295 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00296 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00297 pfxOccupancyGoodStripsVsStripNumber.push_back(tmp->getTProfile());
00298 pfxOccupancyGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00299 pfxOccupancyGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Occupancy)");
00300
00301 histoName = "projYOccupancyGoodStripsVsStripNumber" + subDetName[i];
00302 histoTitle = "Distribution of good strip occupancy";
00303 if(i!=0)
00304 histoTitle += " in " + subDetName[i];
00305 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -8., 0.);
00306 projYOccupancyGoodStripsVsStripNumber.push_back(tmp->getTH1F());
00307 projYOccupancyGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
00308 projYOccupancyGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00309
00310
00311 histoName = "poissonProbVsStripNumber" + subDetName[i];
00312 histoTitle = "Poisson probability of strips vs. strip number";
00313 if(i!=0)
00314 histoTitle += " in " + subDetName[i];
00315 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -18., 0.);
00316 poissonProbVsStripNumber.push_back(tmp->getTH2F());
00317
00318 histoName = "pfxPoissonProbVsStripNumber" + subDetName[i];
00319 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00320 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00321 pfxPoissonProbVsStripNumber.push_back(tmp->getTProfile());
00322 pfxPoissonProbVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00323 pfxPoissonProbVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Probability)");
00324
00325 histoName = "projYPoissonProbVsStripNumber" + subDetName[i];
00326 histoTitle = "Distribution of strip Poisson probability";
00327 if(i!=0)
00328 histoTitle += " in " + subDetName[i];
00329 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -18., 0.);
00330 projYPoissonProbVsStripNumber.push_back(tmp->getTH1F());
00331 projYPoissonProbVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Probability)");
00332 projYPoissonProbVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00333
00334
00335 histoName = "poissonProbHotStripsVsStripNumber" + subDetName[i];
00336 histoTitle = "Poisson probability of hot strips vs. strip number";
00337 if(i!=0)
00338 histoTitle += " in " + subDetName[i];
00339 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -18., 0.);
00340 poissonProbHotStripsVsStripNumber.push_back(tmp->getTH2F());
00341
00342 histoName = "pfxPoissonProbHotStripsVsStripNumber" + subDetName[i];
00343 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00344 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00345 pfxPoissonProbHotStripsVsStripNumber.push_back(tmp->getTProfile());
00346 pfxPoissonProbHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00347 pfxPoissonProbHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Probability)");
00348
00349 histoName = "projYPoissonProbHotStripsVsStripNumber" + subDetName[i];
00350 histoTitle = "Distribution of hot strip Poisson probability";
00351 if(i!=0)
00352 histoTitle += " in " + subDetName[i];
00353 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -18., 0.);
00354 projYPoissonProbHotStripsVsStripNumber.push_back(tmp->getTH1F());
00355 projYPoissonProbHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Probability)");
00356 projYPoissonProbHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00357
00358
00359 histoName = "poissonProbGoodStripsVsStripNumber" + subDetName[i];
00360 histoTitle = "Poisson probability of good strips vs. strip number";
00361 if(i!=0)
00362 histoTitle += " in " + subDetName[i];
00363 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -18., 0.);
00364 poissonProbGoodStripsVsStripNumber.push_back(tmp->getTH2F());
00365
00366 histoName = "pfxPoissonProbGoodStripsVsStripNumber" + subDetName[i];
00367 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00368 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00369 pfxPoissonProbGoodStripsVsStripNumber.push_back(tmp->getTProfile());
00370 pfxPoissonProbGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
00371 pfxPoissonProbGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Probability)");
00372
00373 histoName = "projYPoissonProbGoodStripsVsStripNumber" + subDetName[i];
00374 histoTitle = "Distribution of good strip Poisson probability";
00375 if(i!=0)
00376 histoTitle += " in " + subDetName[i];
00377 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -18., 0.);
00378 projYPoissonProbGoodStripsVsStripNumber.push_back(tmp->getTH1F());
00379 projYPoissonProbGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Probability)");
00380 projYPoissonProbGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00381
00382
00383 histoName = "nHitsVsStripNumber" + subDetName[i];
00384 histoTitle = "NHits in strips vs. strip number";
00385 if(i!=0)
00386 histoTitle += " in " + subDetName[i];
00387 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 10000, -0.5, 9999.5);
00388 nHitsVsStripNumber.push_back(tmp->getTH2F());
00389
00390 histoName = "pfxNHitsVsStripNumber" + subDetName[i];
00391 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00392 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00393 pfxNHitsVsStripNumber.push_back(tmp->getTProfile());
00394
00395 histoName = "projXNHitsVsStripNumber" + subDetName[i];
00396 histoTitle = "Cumulative nHits in strips vs. strip number";
00397 if(i!=0)
00398 histoTitle += " in " + subDetName[i];
00399 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00400 projXNHitsVsStripNumber.push_back(tmp->getTH1F());
00401
00402 histoName = "projYNHitsVsStripNumber" + subDetName[i];
00403 histoTitle = "Distribution of nHits for all strips";
00404 if(i!=0)
00405 histoTitle += " in " + subDetName[i];
00406 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 10000, -0.5, 9999.5);
00407 projYNHitsVsStripNumber.push_back(tmp->getTH1F());
00408 projYNHitsVsStripNumber[i]->GetXaxis()->SetTitle("N_{hits}");
00409 projYNHitsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00410
00411
00412 histoName = "nHitsHotStripsVsStripNumber" + subDetName[i];
00413 histoTitle = "NHits in hot strips vs. strip number";
00414 if(i!=0)
00415 histoTitle += " in " + subDetName[i];
00416 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 10000, -0.5, 9999.5);
00417 nHitsHotStripsVsStripNumber.push_back(tmp->getTH2F());
00418
00419 histoName = "pfxNHitsHotStripsVsStripNumber" + subDetName[i];
00420 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00421 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00422 pfxNHitsHotStripsVsStripNumber.push_back(tmp->getTProfile());
00423
00424 histoName = "projXNHitsHotStripsVsStripNumber" + subDetName[i];
00425 histoTitle = "Cumulative nHits in hot strips vs. strip number";
00426 if(i!=0)
00427 histoTitle += " in " + subDetName[i];
00428 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00429 projXNHitsHotStripsVsStripNumber.push_back(tmp->getTH1F());
00430
00431 histoName = "projYNHitsHotStripsVsStripNumber" + subDetName[i];
00432 histoTitle = "Distribution of nHits for hot strips";
00433 if(i!=0)
00434 histoTitle += " in " + subDetName[i];
00435 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 10000, -0.5, 9999.5);
00436 projYNHitsHotStripsVsStripNumber.push_back(tmp->getTH1F());
00437 projYNHitsHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("N_{hits}");
00438 projYNHitsHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00439
00440
00441 histoName = "nHitsGoodStripsVsStripNumber" + subDetName[i];
00442 histoTitle = "NHits in good strips vs. strip number";
00443 if(i!=0)
00444 histoTitle += " in " + subDetName[i];
00445 tmp = dqmStore_->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 10000, -0.5, 9999.5);
00446 nHitsGoodStripsVsStripNumber.push_back(tmp->getTH2F());
00447
00448 histoName = "pfxNHitsGoodStripsVsStripNumber" + subDetName[i];
00449 tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00450 tmp = dqmStore_->bookProfile(histoName.c_str(), tmp_prof);
00451 pfxNHitsGoodStripsVsStripNumber.push_back(tmp->getTProfile());
00452
00453 histoName = "projXNHitsGoodStripsVsStripNumber" + subDetName[i];
00454 histoTitle = "Cumulative nHits in good strips vs. strip number";
00455 if(i!=0)
00456 histoTitle += " in " + subDetName[i];
00457 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
00458 projXNHitsGoodStripsVsStripNumber.push_back(tmp->getTH1F());
00459
00460 histoName = "projYNHitsGoodStripsVsStripNumber" + subDetName[i];
00461 histoTitle = "Distribution of nHits for good strips";
00462 if(i!=0)
00463 histoTitle += " in " + subDetName[i];
00464 tmp = dqmStore_->book1D(histoName.c_str(), histoTitle.c_str(), 10000, -0.5, 9999.5);
00465 projYNHitsGoodStripsVsStripNumber.push_back(tmp->getTH1F());
00466 projYNHitsGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("N_{hits}");
00467 projYNHitsGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
00468 }
00469
00470 }
00471
00472
00473 void
00474 StripValidationPlots::endJob() {
00475
00476 infile = new TFile(infilename.c_str(),"READ");
00477 intree = (TTree*)infile->Get("stripOccupancy");
00478
00479 intree->SetBranchAddress("DetRawId", &DetRawId);
00480 intree->SetBranchAddress("SubDetId", &SubDetId);
00481 intree->SetBranchAddress("Layer_Ring", &Layer_Ring);
00482 intree->SetBranchAddress("Disc", &Disc);
00483 intree->SetBranchAddress("IsBack", &IsBack);
00484 intree->SetBranchAddress("IsExternalString", &IsExternalString);
00485 intree->SetBranchAddress("IsZMinusSide", &IsZMinusSide);
00486 intree->SetBranchAddress("RodStringPetal", &RodStringPetal);
00487 intree->SetBranchAddress("IsStereo", &IsStereo);
00488 intree->SetBranchAddress("ModulePosition", &ModulePosition);
00489 intree->SetBranchAddress("NumberOfStrips", &NumberOfStrips);
00490 intree->SetBranchAddress("StripNumber", &StripNumber);
00491 intree->SetBranchAddress("APVChannel", &APVChannel);
00492 intree->SetBranchAddress("StripGlobalPositionX", &StripGlobalPositionX);
00493 intree->SetBranchAddress("StripGlobalPositionY", &StripGlobalPositionY);
00494 intree->SetBranchAddress("StripGlobalPositionZ", &StripGlobalPositionZ);
00495 intree->SetBranchAddress("IsHot", &IsHot);
00496 intree->SetBranchAddress("HotStripsPerAPV", &HotStripsPerAPV);
00497 intree->SetBranchAddress("HotStripsPerModule", &HotStripsPerModule);
00498 intree->SetBranchAddress("StripOccupancy", &StripOccupancy);
00499 intree->SetBranchAddress("StripHits", &StripHits);
00500 intree->SetBranchAddress("PoissonProb", &PoissonProb);
00501
00502 for (int i=0; i<intree->GetEntries(); )
00503 {
00504 intree->GetEntry(i);
00505
00506 savedNStrips = NumberOfStrips;
00507 firstEntry = i;
00508 savedDetRawId = DetRawId;
00509 savedSubDetId = SubDetId;
00510 vHotStripsInModule.clear();
00511
00512 for(int j = firstEntry; j < firstEntry + savedNStrips; j++)
00513 {
00514 intree->GetEntry(j);
00515
00516 if(DetRawId != savedDetRawId)
00517 {
00518 std::cout << "ERROR! DetRawId changed but I expected to be on the same module!\n";
00519 return;
00520 }
00521
00522 double logStripOccupancy = log10(StripOccupancy);
00523 double logPoissonProb = log10(fabs(PoissonProb));
00524
00525 (nReadStrips[StripNumber-1][0])++;
00526 (nReadStrips[StripNumber-1][SubDetId-2])++;
00527
00528 occupancyVsStripNumber[0]->Fill(StripNumber,logStripOccupancy);
00529 occupancyVsStripNumber[SubDetId-2]->Fill(StripNumber,logStripOccupancy);
00530 poissonProbVsStripNumber[0]->Fill(StripNumber,logPoissonProb);
00531 poissonProbVsStripNumber[SubDetId-2]->Fill(StripNumber,logPoissonProb);
00532 nHitsVsStripNumber[0]->Fill(StripNumber,StripHits);
00533 nHitsVsStripNumber[SubDetId-2]->Fill(StripNumber,StripHits);
00534
00535 if(IsHot)
00536 {
00537 vHotStripsInModule.push_back(StripNumber);
00538
00539 occupancyHotStripsVsStripNumber[0]->Fill(StripNumber,logStripOccupancy);
00540 occupancyHotStripsVsStripNumber[SubDetId-2]->Fill(StripNumber,logStripOccupancy);
00541 poissonProbHotStripsVsStripNumber[0]->Fill(StripNumber,logPoissonProb);
00542 poissonProbHotStripsVsStripNumber[SubDetId-2]->Fill(StripNumber,logPoissonProb);
00543 nHitsHotStripsVsStripNumber[0]->Fill(StripNumber,StripHits);
00544 nHitsHotStripsVsStripNumber[SubDetId-2]->Fill(StripNumber,StripHits);
00545 }
00546 else
00547 {
00548 occupancyGoodStripsVsStripNumber[0]->Fill(StripNumber,logStripOccupancy);
00549 occupancyGoodStripsVsStripNumber[SubDetId-2]->Fill(StripNumber,logStripOccupancy);
00550 poissonProbGoodStripsVsStripNumber[0]->Fill(StripNumber,logPoissonProb);
00551 poissonProbGoodStripsVsStripNumber[SubDetId-2]->Fill(StripNumber,logPoissonProb);
00552 nHitsGoodStripsVsStripNumber[0]->Fill(StripNumber,StripHits);
00553 nHitsGoodStripsVsStripNumber[SubDetId-2]->Fill(StripNumber,StripHits);
00554 }
00555 }
00556
00557 if(vHotStripsInModule.size()==1)
00558 {
00559 distance = 999;
00560 distanceVsStripNumber[0]->Fill(vHotStripsInModule[0], distance);
00561 distanceVsStripNumber[savedSubDetId-2]->Fill(vHotStripsInModule[0], distance);
00562 }
00563 else if(vHotStripsInModule.size()>1)
00564 {
00565 for(unsigned int iVec = 0; iVec != vHotStripsInModule.size(); iVec++)
00566 {
00567 if(iVec==0)
00568 distance = vHotStripsInModule[1] - vHotStripsInModule[0];
00569 else if(iVec==vHotStripsInModule.size()-1)
00570 {
00571 distance = vHotStripsInModule[vHotStripsInModule.size()-1] - vHotStripsInModule[vHotStripsInModule.size() -2];
00572 }
00573 else if(vHotStripsInModule.size()>2)
00574 {
00575 distanceR = vHotStripsInModule[iVec + 1] - vHotStripsInModule[iVec];
00576 distanceL = vHotStripsInModule[iVec] - vHotStripsInModule[iVec - 1];
00577 distance = distanceL>distanceR?distanceR:distanceL;
00578 }
00579 else
00580 {
00581 std::cout << "ERROR! distance is never computed!!!\n";
00582 }
00583
00584 distanceVsStripNumber[0]->Fill(vHotStripsInModule[iVec], distance);
00585 distanceVsStripNumber[savedSubDetId-2]->Fill(vHotStripsInModule[iVec], distance);
00586 }
00587 }
00588
00589 i+=savedNStrips;
00590
00591 }
00592
00593
00594 std::string histoName;
00595 std::string histoTitle;
00596
00597 for(unsigned int i = 0; i < subDetName.size(); i++)
00598 {
00599 projYDistanceVsStripNumber[i]->Add((TH1F*)distanceVsStripNumber[i]->ProjectionY());
00600 pfxDistanceVsStripNumber[i]->Add(distanceVsStripNumber[i]->ProfileX(pfxDistanceVsStripNumber[i]->GetName(),1,998));
00601 projYNHitsVsStripNumber[i]->Add(nHitsVsStripNumber[i]->ProjectionY());
00602 projYNHitsGoodStripsVsStripNumber[i]->Add(nHitsGoodStripsVsStripNumber[i]->ProjectionY());
00603 projYNHitsHotStripsVsStripNumber[i]->Add(nHitsHotStripsVsStripNumber[i]->ProjectionY());
00604 projYOccupancyVsStripNumber[i]->Add(occupancyVsStripNumber[i]->ProjectionY());
00605 projYOccupancyGoodStripsVsStripNumber[i]->Add(occupancyGoodStripsVsStripNumber[i]->ProjectionY());
00606 projYOccupancyHotStripsVsStripNumber[i]->Add(occupancyHotStripsVsStripNumber[i]->ProjectionY());
00607 pfxOccupancyVsStripNumber[i]->Add(occupancyVsStripNumber[i]->ProfileX(pfxOccupancyVsStripNumber[i]->GetName(),-8.,0.));
00608 pfxOccupancyGoodStripsVsStripNumber[i]->Add(occupancyGoodStripsVsStripNumber[i]->ProfileX(pfxOccupancyGoodStripsVsStripNumber[i]->GetName(),-8.,0.));
00609 pfxOccupancyHotStripsVsStripNumber[i]->Add(occupancyHotStripsVsStripNumber[i]->ProfileX(pfxOccupancyHotStripsVsStripNumber[i]->GetName(),-8.,0.));
00610 projYPoissonProbVsStripNumber[i]->Add(poissonProbVsStripNumber[i]->ProjectionY());
00611 projYPoissonProbGoodStripsVsStripNumber[i]->Add(poissonProbGoodStripsVsStripNumber[i]->ProjectionY());
00612 projYPoissonProbHotStripsVsStripNumber[i]->Add(poissonProbHotStripsVsStripNumber[i]->ProjectionY());
00613 pfxPoissonProbVsStripNumber[i]->Add(poissonProbVsStripNumber[i]->ProfileX(pfxPoissonProbVsStripNumber[i]->GetName(),-18., 0.));
00614 pfxPoissonProbGoodStripsVsStripNumber[i]->Add(poissonProbGoodStripsVsStripNumber[i]->ProfileX(pfxPoissonProbGoodStripsVsStripNumber[i]->GetName(),-18., 0.));
00615 pfxPoissonProbHotStripsVsStripNumber[i]->Add(poissonProbHotStripsVsStripNumber[i]->ProfileX(pfxPoissonProbHotStripsVsStripNumber[i]->GetName(),-18., 0.));
00616 projXDistanceVsStripNumber[i]->Add(distanceVsStripNumber[i]->ProjectionX(projXDistanceVsStripNumber[i]->GetName(),1,998));
00617
00618 }
00619
00620 dqmStore_->cd();
00621 dqmStore_->save(outfilename.c_str(),"ChannelStatusPlots");
00622
00623 }
00624
00625
00626 DEFINE_FWK_MODULE(StripValidationPlots);