CMS 3D CMS Logo

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

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 APVValidationPlots (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

const std::string infilename
 
const std::string outfilename
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 35 of file APVValidationPlots.cc.

Member Typedef Documentation

Definition at line 37 of file APVValidationPlots.cc.

Definition at line 38 of file APVValidationPlots.cc.

Constructor & Destructor Documentation

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

Definition at line 55 of file APVValidationPlots.cc.

56  : infilename(iConfig.getUntrackedParameter<std::string>("inputFilename", "in.root")),
57  outfilename(iConfig.getUntrackedParameter<std::string>("outputFilename", "out.root"))
58 
59 {
60  //now do what ever initialization is needed
61 }
const std::string infilename
T getUntrackedParameter(std::string const &, T const &) const
const std::string outfilename

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 68 of file APVValidationPlots.cc.

68 {}
void APVValidationPlots::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 71 of file APVValidationPlots.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::DQMStore::cd(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH2F(), mps_fire::i, timingPdfMaker::infile, infilename, dqmiolumiharvest::j, phase1PixelTopology::layer, phase1PixelTopology::layerName, mkfit::Config::nLayers, Utilities::operator, outfilename, dqm::implementation::DQMStore::save(), dqm::implementation::DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

71  {
72  std::ostringstream oss;
73  oss << 1; //runNumber
74 
75  DQMStore* dqmStore = edm::Service<DQMStore>().operator->();
76  dqmStore->setCurrentFolder("ChannelStatusPlots");
77 
78  // Initialize histograms
79  std::vector<std::string> subDetName;
80  std::vector<unsigned int> nLayers;
81  std::vector<std::string> layerName;
82  subDetName.push_back("");
83  subDetName.push_back("TIB");
84  subDetName.push_back("TID");
85  subDetName.push_back("TOB");
86  subDetName.push_back("TEC");
87  nLayers.push_back(0);
88  nLayers.push_back(4);
89  nLayers.push_back(3);
90  nLayers.push_back(6);
91  nLayers.push_back(9);
92  layerName.push_back("");
93  layerName.push_back("Layer");
94  layerName.push_back("Disk");
95  layerName.push_back("Layer");
96  layerName.push_back("Disk");
97 
98  std::string histoName;
99  std::string histoTitle;
100  // Histograms
101  // indexes in these arrays are [SubDetId-2][LayerN]
102  // histograms for [SubDetId-2][0] are global for the subdetector
103  // histogram for [0][0] is global for the tracker
104  TH2F* medianVsAbsoluteOccupancy[5][10];
105  TH1F* medianOccupancy[5][10];
106  TH1F* absoluteOccupancy[5][10];
107  for (unsigned int i = 0; i < subDetName.size(); i++) {
108  for (unsigned int j = 0; j <= nLayers[i]; j++) {
109  histoName = "medianVsAbsoluteOccupancy" + subDetName[i];
110  if (j != 0) {
111  oss.str("");
112  oss << j;
113  histoName += layerName[i] + oss.str();
114  }
115  histoTitle = "Median APV occupancy vs. absolute APV occupancy";
116  if (i != 0)
117  histoTitle += " in " + subDetName[i];
118  if (j != 0) {
119  histoTitle += " " + layerName[i] + " " + oss.str();
120  }
121  MonitorElement* tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6., 1000, -1., 3.);
122  medianVsAbsoluteOccupancy[i][j] = tmp->getTH2F();
123  medianVsAbsoluteOccupancy[i][j]->Rebin2D(10, 10);
124  medianVsAbsoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Abs. Occupancy)");
125  medianVsAbsoluteOccupancy[i][j]->GetYaxis()->SetTitle("log_{10}(Median Occupancy)");
126  //
127  histoName = "medianOccupancy" + subDetName[i];
128  if (j != 0) {
129  oss.str("");
130  oss << j;
131  histoName += layerName[i] + oss.str();
132  }
133  histoTitle = "Median APV occupancy";
134  if (i != 0)
135  histoTitle += " in " + subDetName[i];
136  if (j != 0) {
137  histoTitle += " " + layerName[i] + " " + oss.str();
138  }
139  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -1., 3.);
140  medianOccupancy[i][j] = tmp->getTH1F();
141  medianOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
142  medianOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
143  //
144  histoName = "absoluteOccupancy" + subDetName[i];
145  if (j != 0) {
146  oss.str("");
147  oss << j;
148  histoName += layerName[i] + oss.str();
149  }
150  histoTitle = "Absolute APV occupancy";
151  if (i != 0)
152  histoTitle += " in " + subDetName[i];
153  if (j != 0) {
154  histoTitle += " " + layerName[i] + " " + oss.str();
155  }
156  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6.);
157  absoluteOccupancy[i][j] = tmp->getTH1F();
158  absoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
159  absoluteOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
160  }
161  }
162 
163  TFile* infile = new TFile(infilename.c_str(), "READ");
164  TTree* intree = (TTree*)infile->Get("moduleOccupancy");
165 
166  // Declaration of leaf types
167  Int_t DetRawId;
168  Int_t SubDetId;
169  Int_t Layer_Ring;
170  Int_t Disc;
171  Int_t IsBack;
172  Int_t IsExternalString;
173  Int_t IsZMinusSide;
174  Int_t RodStringPetal;
175  Int_t IsStereo;
176  Int_t ModulePosition;
177  Int_t NumberOfStrips;
178  Float_t APVGlobalPositionX;
179  Float_t APVGlobalPositionY;
180  Float_t APVGlobalPositionZ;
181  Int_t APVNumber;
182  Int_t APVAbsoluteOccupancy;
183  Double_t APVMedianOccupancy;
184  intree->SetBranchAddress("DetRawId", &DetRawId);
185  intree->SetBranchAddress("SubDetId", &SubDetId);
186  intree->SetBranchAddress("Layer_Ring", &Layer_Ring);
187  intree->SetBranchAddress("Disc", &Disc);
188  intree->SetBranchAddress("IsBack", &IsBack);
189  intree->SetBranchAddress("IsExternalString", &IsExternalString);
190  intree->SetBranchAddress("IsZMinusSide", &IsZMinusSide);
191  intree->SetBranchAddress("RodStringPetal", &RodStringPetal);
192  intree->SetBranchAddress("IsStereo", &IsStereo);
193  intree->SetBranchAddress("ModuleNumber", &ModulePosition);
194  intree->SetBranchAddress("NumberOfStrips", &NumberOfStrips);
195  intree->SetBranchAddress("APVGlobalPositionX", &APVGlobalPositionX);
196  intree->SetBranchAddress("APVGlobalPositionY", &APVGlobalPositionY);
197  intree->SetBranchAddress("APVGlobalPositionZ", &APVGlobalPositionZ);
198  intree->SetBranchAddress("APVNumber", &APVNumber);
199  intree->SetBranchAddress("APVAbsoluteOccupancy", &APVAbsoluteOccupancy);
200  intree->SetBranchAddress("APVMedianOccupancy", &APVMedianOccupancy);
201 
202  for (int i = 0; i < intree->GetEntries(); i++) {
203  intree->GetEntry(i);
204 
205  double logMedianOccupancy = -1;
206  double logAbsoluteOccupancy = -1;
207 
208  if (APVMedianOccupancy > 0)
209  logMedianOccupancy = log10(APVMedianOccupancy);
210  if (APVAbsoluteOccupancy > 0)
211  logAbsoluteOccupancy = log10(APVAbsoluteOccupancy);
212 
213  // The layer/disk information is stored in Layer_Ring for TIB/TOB and in Disc for TID/TEC
214  unsigned int layer = 0;
215  if (SubDetId == 3 || SubDetId == 5)
216  layer = Layer_Ring;
217  else
218  layer = Disc;
219 
220  // Fill histograms for all the tracker
221  medianVsAbsoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
222  medianOccupancy[0][0]->Fill(logMedianOccupancy);
223  absoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy);
224  // Fill summary histograms for each subdetector
225  medianVsAbsoluteOccupancy[SubDetId - 2][0]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
226  medianOccupancy[SubDetId - 2][0]->Fill(logMedianOccupancy);
227  absoluteOccupancy[SubDetId - 2][0]->Fill(logAbsoluteOccupancy);
228  // Fill histograms for each layer/disk
229  medianVsAbsoluteOccupancy[SubDetId - 2][layer]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
230  medianOccupancy[SubDetId - 2][layer]->Fill(logMedianOccupancy);
231  absoluteOccupancy[SubDetId - 2][layer]->Fill(logAbsoluteOccupancy);
232  }
233 
234  dqmStore->cd();
235  dqmStore->save(outfilename, "ChannelStatusPlots");
236 }
const std::string infilename
virtual TH2F * getTH2F() const
constexpr char const * layerName[numberOfLayers]
virtual TH1F * getTH1F() const
const std::string outfilename
constexpr std::array< uint8_t, layerIndexSize > layer
constexpr int nLayers
Definition: Config.h:73
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

const std::string APVValidationPlots::infilename
private

Definition at line 46 of file APVValidationPlots.cc.

Referenced by endJob().

const std::string APVValidationPlots::outfilename
private

Definition at line 47 of file APVValidationPlots.cc.

Referenced by endJob().