CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

APVValidationPlots Class Reference

Inheritance diagram for APVValidationPlots:
edm::EDAnalyzer

List of all members.

Public Member Functions

 APVValidationPlots (const edm::ParameterSet &)
 ~APVValidationPlots ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void endJob ()

Private Attributes

TH1F * absoluteOccupancy [5][10]
Int_t APVAbsoluteOccupancy
Float_t APVGlobalPositionX
Float_t APVGlobalPositionY
Float_t APVGlobalPositionZ
Double_t APVMedianOccupancy
Int_t APVNumber
Int_t DetRawId
Int_t Disc
DQMStoredqmStore
TFile * infile
std::string infilename
TTree * intree
Int_t IsBack
Int_t IsExternalString
Int_t IsStereo
Int_t IsZMinusSide
Int_t Layer_Ring
std::vector< std::string > layerName
TH1F * medianOccupancy [5][10]
TH2F * medianVsAbsoluteOccupancy [5][10]
Int_t ModulePosition
std::vector< unsigned int > nLayers
Int_t NumberOfStrips
std::ostringstream oss
std::string outfilename
Int_t RodStringPetal
Int_t SubDetId
std::vector< std::string > subDetName
MonitorElementtmp

Detailed Description

Definition at line 45 of file APVValidationPlots.cc.


Constructor & Destructor Documentation

APVValidationPlots::APVValidationPlots ( const edm::ParameterSet iConfig) [explicit]

Definition at line 116 of file APVValidationPlots.cc.

                                                                     : infilename(iConfig.getUntrackedParameter<std::string>("inputFilename","in.root")),
                                                                           outfilename(iConfig.getUntrackedParameter<std::string>("outputFilename","out.root"))

{
   //now do what ever initialization is needed

}
APVValidationPlots::~APVValidationPlots ( )

Definition at line 125 of file APVValidationPlots.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void APVValidationPlots::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 140 of file APVValidationPlots.cc.

{

}
void APVValidationPlots::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 148 of file APVValidationPlots.cc.

References absoluteOccupancy, DQMStore::book1D(), DQMStore::book2D(), dqmStore, MonitorElement::getTH1F(), MonitorElement::getTH2F(), i, j, layerName, medianOccupancy, medianVsAbsoluteOccupancy, nLayers, cmsCodeRules::cppFunctionSkipper::operator, oss, DQMStore::setCurrentFolder(), subDetName, and tmp.

{
  oss.str("");
  oss << 1; //runNumber

  dqmStore = edm::Service<DQMStore>().operator->();
  dqmStore->setCurrentFolder("ChannelStatusPlots");

  // Initialize histograms
  subDetName.push_back(""); subDetName.push_back("TIB"); subDetName.push_back("TID"); subDetName.push_back("TOB"); subDetName.push_back("TEC");
  nLayers.push_back(0); nLayers.push_back(4); nLayers.push_back(3); nLayers.push_back(6); nLayers.push_back(9);
  layerName.push_back(""); layerName.push_back("Layer"); layerName.push_back("Disk"); layerName.push_back("Layer"); layerName.push_back("Disk");
  
  std::string histoName;
  std::string histoTitle;
  for(unsigned int i = 0; i < subDetName.size(); i++)
  {
    for(unsigned int j = 0; j <= nLayers[i]; j++)
    {
      histoName = "medianVsAbsoluteOccupancy" + subDetName[i];
      if(j!=0)
      {
        oss.str("");
        oss << j;
        histoName += layerName[i] + oss.str();
      }
      histoTitle = "Median APV occupancy vs. absolute APV occupancy";
      if(i!=0)
        histoTitle += " in " + subDetName[i];
      if(j!=0)
      {
        histoTitle += " " + layerName[i] + " " + oss.str();
      }
      tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6., 1000, -1., 3.);
      medianVsAbsoluteOccupancy[i][j] = tmp->getTH2F();
      medianVsAbsoluteOccupancy[i][j]->Rebin2D(10,10);
      medianVsAbsoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Abs. Occupancy)");
      medianVsAbsoluteOccupancy[i][j]->GetYaxis()->SetTitle("log_{10}(Median Occupancy)");
      //
      histoName = "medianOccupancy" + subDetName[i];
      if(j!=0)
      {
        oss.str("");
        oss << j;
        histoName += layerName[i] + oss.str();
      }
      histoTitle = "Median APV occupancy";
      if(i!=0)
        histoTitle += " in " + subDetName[i];
      if(j!=0)
      {
        histoTitle += " " + layerName[i] + " " + oss.str();
      }
      tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -1., 3.);
      medianOccupancy[i][j] = tmp->getTH1F();
      medianOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
      medianOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
      //
      histoName = "absoluteOccupancy" + subDetName[i];
      if(j!=0)
      {
        oss.str("");
        oss << j;
        histoName += layerName[i] + oss.str();
      }
      histoTitle = "Absolute APV occupancy";
      if(i!=0)
        histoTitle += " in " + subDetName[i];
      if(j!=0)
      {
        histoTitle += " " + layerName[i] + " " + oss.str();
      }
      tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6.);
      absoluteOccupancy[i][j] = tmp->getTH1F();
      absoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
      absoluteOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
    }
  }

}
void APVValidationPlots::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 231 of file APVValidationPlots.cc.

References absoluteOccupancy, APVAbsoluteOccupancy, APVGlobalPositionX, APVGlobalPositionY, APVGlobalPositionZ, APVMedianOccupancy, APVNumber, DQMStore::cd(), DetRawId, Disc, dqmStore, i, infile, infilename, intree, IsBack, IsExternalString, IsStereo, IsZMinusSide, Layer_Ring, medianOccupancy, medianVsAbsoluteOccupancy, ModulePosition, NumberOfStrips, outfilename, RodStringPetal, DQMStore::save(), and SubDetId.

                           {

  infile = new TFile(infilename.c_str(),"READ");
  intree = (TTree*)infile->Get("moduleOccupancy");

  intree->SetBranchAddress("DetRawId",             &DetRawId);
  intree->SetBranchAddress("SubDetId",             &SubDetId);
  intree->SetBranchAddress("Layer_Ring",           &Layer_Ring);
  intree->SetBranchAddress("Disc",                 &Disc);
  intree->SetBranchAddress("IsBack",               &IsBack);
  intree->SetBranchAddress("IsExternalString",     &IsExternalString);
  intree->SetBranchAddress("IsZMinusSide",         &IsZMinusSide);
  intree->SetBranchAddress("RodStringPetal",       &RodStringPetal);
  intree->SetBranchAddress("IsStereo",             &IsStereo);
  intree->SetBranchAddress("ModuleNumber",         &ModulePosition);
  intree->SetBranchAddress("NumberOfStrips",       &NumberOfStrips);
  intree->SetBranchAddress("APVGlobalPositionX",   &APVGlobalPositionX);
  intree->SetBranchAddress("APVGlobalPositionY",   &APVGlobalPositionY);
  intree->SetBranchAddress("APVGlobalPositionZ",   &APVGlobalPositionZ);
  intree->SetBranchAddress("APVNumber",            &APVNumber);
  intree->SetBranchAddress("APVAbsoluteOccupancy", &APVAbsoluteOccupancy);
  intree->SetBranchAddress("APVMedianOccupancy",   &APVMedianOccupancy);

  for (int i=0; i<intree->GetEntries(); i++)
    {
      intree->GetEntry(i);

      double logMedianOccupancy = -1;
      double logAbsoluteOccupancy = -1;

      if (APVMedianOccupancy>0) logMedianOccupancy = log10(APVMedianOccupancy);
      if (APVAbsoluteOccupancy>0) logAbsoluteOccupancy = log10(APVAbsoluteOccupancy);

      // The layer/disk information is stored in Layer_Ring for TIB/TOB and in Disc for TID/TEC
      unsigned int layer = 0;
      if(SubDetId==3 || SubDetId==5)
        layer=Layer_Ring;
      else
        layer=Disc;

      // Fill histograms for all the tracker
      medianVsAbsoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
      medianOccupancy[0][0]->Fill(logMedianOccupancy);
      absoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy);
      // Fill summary histograms for each subdetector
      medianVsAbsoluteOccupancy[SubDetId-2][0]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
      medianOccupancy[SubDetId-2][0]->Fill(logMedianOccupancy);
      absoluteOccupancy[SubDetId-2][0]->Fill(logAbsoluteOccupancy);
      // Fill histograms for each layer/disk
      medianVsAbsoluteOccupancy[SubDetId-2][layer]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
      medianOccupancy[SubDetId-2][layer]->Fill(logMedianOccupancy);
      absoluteOccupancy[SubDetId-2][layer]->Fill(logAbsoluteOccupancy);
    }

  dqmStore->cd();
  dqmStore->save(outfilename.c_str(),"ChannelStatusPlots");

}

Member Data Documentation

TH1F* APVValidationPlots::absoluteOccupancy[5][10] [private]

Definition at line 69 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

Definition at line 97 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 93 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 94 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 95 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 98 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 96 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 82 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::Disc [private]

Definition at line 85 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 58 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

TFile* APVValidationPlots::infile [private]

Definition at line 78 of file APVValidationPlots.cc.

Referenced by endJob().

std::string APVValidationPlots::infilename [private]

Definition at line 75 of file APVValidationPlots.cc.

Referenced by endJob().

TTree* APVValidationPlots::intree [private]

Definition at line 79 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::IsBack [private]

Definition at line 86 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 87 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 90 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 88 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 84 of file APVValidationPlots.cc.

Referenced by endJob().

std::vector<std::string> APVValidationPlots::layerName [private]

Definition at line 73 of file APVValidationPlots.cc.

Referenced by beginJob().

TH1F* APVValidationPlots::medianOccupancy[5][10] [private]

Definition at line 68 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

Definition at line 67 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

Definition at line 91 of file APVValidationPlots.cc.

Referenced by endJob().

std::vector<unsigned int> APVValidationPlots::nLayers [private]

Definition at line 72 of file APVValidationPlots.cc.

Referenced by beginJob().

Definition at line 92 of file APVValidationPlots.cc.

Referenced by endJob().

std::ostringstream APVValidationPlots::oss [private]

Definition at line 56 of file APVValidationPlots.cc.

Referenced by beginJob().

std::string APVValidationPlots::outfilename [private]

Definition at line 76 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 89 of file APVValidationPlots.cc.

Referenced by endJob().

Definition at line 83 of file APVValidationPlots.cc.

Referenced by endJob().

std::vector<std::string> APVValidationPlots::subDetName [private]

Definition at line 71 of file APVValidationPlots.cc.

Referenced by beginJob().

Definition at line 60 of file APVValidationPlots.cc.

Referenced by beginJob().