CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
APVValidationPlots Class Reference
Inheritance diagram for APVValidationPlots:
edm::EDAnalyzer

Public Member Functions

 APVValidationPlots (const edm::ParameterSet &)
 
 ~APVValidationPlots ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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.

116  : infilename(iConfig.getUntrackedParameter<std::string>("inputFilename","in.root")),
117  outfilename(iConfig.getUntrackedParameter<std::string>("outputFilename","out.root"))
118 
119 {
120  //now do what ever initialization is needed
121 
122 }
T getUntrackedParameter(std::string const &, T const &) const
APVValidationPlots::~APVValidationPlots ( )

Definition at line 125 of file APVValidationPlots.cc.

126 {
127 
128  // do anything here that needs to be done at desctruction time
129  // (e.g. close files, deallocate resources etc.)
130 
131 }

Member Function Documentation

void APVValidationPlots::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 140 of file APVValidationPlots.cc.

141 {
142 
143 }
void APVValidationPlots::beginJob ( void  )
privatevirtual

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, cppFunctionSkipper::operator, oss, DQMStore::setCurrentFolder(), subDetName, and tmp.

149 {
150  oss.str("");
151  oss << 1; //runNumber
152 
154  dqmStore->setCurrentFolder("ChannelStatusPlots");
155 
156  // Initialize histograms
157  subDetName.push_back(""); subDetName.push_back("TIB"); subDetName.push_back("TID"); subDetName.push_back("TOB"); subDetName.push_back("TEC");
158  nLayers.push_back(0); nLayers.push_back(4); nLayers.push_back(3); nLayers.push_back(6); nLayers.push_back(9);
159  layerName.push_back(""); layerName.push_back("Layer"); layerName.push_back("Disk"); layerName.push_back("Layer"); layerName.push_back("Disk");
160 
161  std::string histoName;
162  std::string histoTitle;
163  for(unsigned int i = 0; i < subDetName.size(); i++)
164  {
165  for(unsigned int j = 0; j <= nLayers[i]; j++)
166  {
167  histoName = "medianVsAbsoluteOccupancy" + subDetName[i];
168  if(j!=0)
169  {
170  oss.str("");
171  oss << j;
172  histoName += layerName[i] + oss.str();
173  }
174  histoTitle = "Median APV occupancy vs. absolute APV occupancy";
175  if(i!=0)
176  histoTitle += " in " + subDetName[i];
177  if(j!=0)
178  {
179  histoTitle += " " + layerName[i] + " " + oss.str();
180  }
181  tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6., 1000, -1., 3.);
183  medianVsAbsoluteOccupancy[i][j]->Rebin2D(10,10);
184  medianVsAbsoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Abs. Occupancy)");
185  medianVsAbsoluteOccupancy[i][j]->GetYaxis()->SetTitle("log_{10}(Median Occupancy)");
186  //
187  histoName = "medianOccupancy" + subDetName[i];
188  if(j!=0)
189  {
190  oss.str("");
191  oss << j;
192  histoName += layerName[i] + oss.str();
193  }
194  histoTitle = "Median APV occupancy";
195  if(i!=0)
196  histoTitle += " in " + subDetName[i];
197  if(j!=0)
198  {
199  histoTitle += " " + layerName[i] + " " + oss.str();
200  }
201  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -1., 3.);
202  medianOccupancy[i][j] = tmp->getTH1F();
203  medianOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
204  medianOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
205  //
206  histoName = "absoluteOccupancy" + subDetName[i];
207  if(j!=0)
208  {
209  oss.str("");
210  oss << j;
211  histoName += layerName[i] + oss.str();
212  }
213  histoTitle = "Absolute APV occupancy";
214  if(i!=0)
215  histoTitle += " in " + subDetName[i];
216  if(j!=0)
217  {
218  histoTitle += " " + layerName[i] + " " + oss.str();
219  }
220  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6.);
222  absoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
223  absoluteOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
224  }
225  }
226 
227 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > subDetName
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
TH1F * medianOccupancy[5][10]
MonitorElement * tmp
TH2F * medianVsAbsoluteOccupancy[5][10]
std::ostringstream oss
int j
Definition: DBlmapReader.cc:9
std::vector< std::string > layerName
TH1F * getTH1F(void) const
std::vector< unsigned int > nLayers
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
TH1F * absoluteOccupancy[5][10]
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void APVValidationPlots::endJob ( void  )
privatevirtual

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.

231  {
232 
233  infile = new TFile(infilename.c_str(),"READ");
234  intree = (TTree*)infile->Get("moduleOccupancy");
235 
236  intree->SetBranchAddress("DetRawId", &DetRawId);
237  intree->SetBranchAddress("SubDetId", &SubDetId);
238  intree->SetBranchAddress("Layer_Ring", &Layer_Ring);
239  intree->SetBranchAddress("Disc", &Disc);
240  intree->SetBranchAddress("IsBack", &IsBack);
241  intree->SetBranchAddress("IsExternalString", &IsExternalString);
242  intree->SetBranchAddress("IsZMinusSide", &IsZMinusSide);
243  intree->SetBranchAddress("RodStringPetal", &RodStringPetal);
244  intree->SetBranchAddress("IsStereo", &IsStereo);
245  intree->SetBranchAddress("ModuleNumber", &ModulePosition);
246  intree->SetBranchAddress("NumberOfStrips", &NumberOfStrips);
247  intree->SetBranchAddress("APVGlobalPositionX", &APVGlobalPositionX);
248  intree->SetBranchAddress("APVGlobalPositionY", &APVGlobalPositionY);
249  intree->SetBranchAddress("APVGlobalPositionZ", &APVGlobalPositionZ);
250  intree->SetBranchAddress("APVNumber", &APVNumber);
251  intree->SetBranchAddress("APVAbsoluteOccupancy", &APVAbsoluteOccupancy);
252  intree->SetBranchAddress("APVMedianOccupancy", &APVMedianOccupancy);
253 
254  for (int i=0; i<intree->GetEntries(); i++)
255  {
256  intree->GetEntry(i);
257 
258  double logMedianOccupancy = -1;
259  double logAbsoluteOccupancy = -1;
260 
261  if (APVMedianOccupancy>0) logMedianOccupancy = log10(APVMedianOccupancy);
262  if (APVAbsoluteOccupancy>0) logAbsoluteOccupancy = log10(APVAbsoluteOccupancy);
263 
264  // The layer/disk information is stored in Layer_Ring for TIB/TOB and in Disc for TID/TEC
265  unsigned int layer = 0;
266  if(SubDetId==3 || SubDetId==5)
267  layer=Layer_Ring;
268  else
269  layer=Disc;
270 
271  // Fill histograms for all the tracker
272  medianVsAbsoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
273  medianOccupancy[0][0]->Fill(logMedianOccupancy);
274  absoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy);
275  // Fill summary histograms for each subdetector
276  medianVsAbsoluteOccupancy[SubDetId-2][0]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
277  medianOccupancy[SubDetId-2][0]->Fill(logMedianOccupancy);
278  absoluteOccupancy[SubDetId-2][0]->Fill(logAbsoluteOccupancy);
279  // Fill histograms for each layer/disk
280  medianVsAbsoluteOccupancy[SubDetId-2][layer]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
281  medianOccupancy[SubDetId-2][layer]->Fill(logMedianOccupancy);
282  absoluteOccupancy[SubDetId-2][layer]->Fill(logAbsoluteOccupancy);
283  }
284 
285  dqmStore->cd();
286  dqmStore->save(outfilename.c_str(),"ChannelStatusPlots");
287 
288 }
int i
Definition: DBlmapReader.cc:9
TH1F * medianOccupancy[5][10]
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
TH2F * medianVsAbsoluteOccupancy[5][10]
TH1F * absoluteOccupancy[5][10]

Member Data Documentation

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

Definition at line 69 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

Int_t APVValidationPlots::APVAbsoluteOccupancy
private

Definition at line 97 of file APVValidationPlots.cc.

Referenced by endJob().

Float_t APVValidationPlots::APVGlobalPositionX
private

Definition at line 93 of file APVValidationPlots.cc.

Referenced by endJob().

Float_t APVValidationPlots::APVGlobalPositionY
private

Definition at line 94 of file APVValidationPlots.cc.

Referenced by endJob().

Float_t APVValidationPlots::APVGlobalPositionZ
private

Definition at line 95 of file APVValidationPlots.cc.

Referenced by endJob().

Double_t APVValidationPlots::APVMedianOccupancy
private

Definition at line 98 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::APVNumber
private

Definition at line 96 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::DetRawId
private

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().

DQMStore* APVValidationPlots::dqmStore
private

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().

Int_t APVValidationPlots::IsExternalString
private

Definition at line 87 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::IsStereo
private

Definition at line 90 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::IsZMinusSide
private

Definition at line 88 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::Layer_Ring
private

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().

TH2F* APVValidationPlots::medianVsAbsoluteOccupancy[5][10]
private

Definition at line 67 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

Int_t APVValidationPlots::ModulePosition
private

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().

Int_t APVValidationPlots::NumberOfStrips
private

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().

Int_t APVValidationPlots::RodStringPetal
private

Definition at line 89 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::SubDetId
private

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().

MonitorElement* APVValidationPlots::tmp
private

Definition at line 60 of file APVValidationPlots.cc.

Referenced by beginJob().