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
SiStripDQMProfileToTkMapConverter Class Reference

#include <SiStripDQMProfileToTkMapConverter.h>

Inheritance diagram for SiStripDQMProfileToTkMapConverter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiStripDQMProfileToTkMapConverter (const edm::ParameterSet &)
 
 ~SiStripDQMProfileToTkMapConverter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

const edm::ParameterSet conf_
 
std::string dirpath
 
DQMStoredqmStore_
 
std::string filename
 
edm::FileInPath fp_
 
SiStripDetInfoFileReaderreader
 
TkHistoMaptkhisto
 
TrackerMaptkMap
 
std::string TkMapFileName_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 26 of file SiStripDQMProfileToTkMapConverter.h.

Constructor & Destructor Documentation

SiStripDQMProfileToTkMapConverter::SiStripDQMProfileToTkMapConverter ( const edm::ParameterSet iConfig)

Definition at line 7 of file SiStripDQMProfileToTkMapConverter.cc.

References dirpath, dqmStore_, filename, fp_, edm::FileInPath::fullPath(), edm::ParameterSet::getUntrackedParameter(), DQMStore::open(), cppFunctionSkipper::operator, reader, DQMStore::setVerbose(), and OfflineSiStripConfigDb_cff::SiStripDetInfoFileReader.

7  :
8  conf_(iConfig),
9  filename(iConfig.getUntrackedParameter<std::string>("rootFilename","CondDB_TKCC_20X_v3_hlt_50822.root")),
10  dirpath(iConfig.getUntrackedParameter<std::string>("rootDirPath","")),
11  TkMapFileName_(iConfig.getUntrackedParameter<std::string>("TkMapFileName",""))
12 {
13  edm::LogInfo("SiStripDQMProfileToTkMapConverter") << " ctor ";
15 
16  edm::LogInfo("SiStripDQMProfileToTkMapConverter") << " before opening file " << filename.c_str();
18  dqmStore_->setVerbose(iConfig.getUntrackedParameter<uint32_t>("verbosity",0));
19 
20  dqmStore_->open(filename.c_str(), false,dirpath);
21  edm::LogInfo("SiStripDQMProfileToTkMapConverter") << " after opening file ";
22 }
T getUntrackedParameter(std::string const &, T const &) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:641
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2910
std::string fullPath() const
Definition: FileInPath.cc:165
SiStripDQMProfileToTkMapConverter::~SiStripDQMProfileToTkMapConverter ( )

Definition at line 25 of file SiStripDQMProfileToTkMapConverter.cc.

25  {
26  edm::LogInfo("SiStripDQMProfileToTkMapConverter") << " dtor";
27 }

Member Function Documentation

void SiStripDQMProfileToTkMapConverter::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 37 of file SiStripDQMProfileToTkMapConverter.h.

37 {};
void SiStripDQMProfileToTkMapConverter::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 29 of file SiStripDQMProfileToTkMapConverter.cc.

References gather_cfg::cout, dirpath, dqmStore_, TkHistoMap::fill(), TrackerMap::fill(), edm::EventSetup::get(), DQMStore::getAllContents(), SiStripSubStructure::getTECDetectors(), SiStripSubStructure::getTIBDetectors(), SiStripSubStructure::getTIDDetectors(), SiStripSubStructure::getTOBDetectors(), getTProfile(), timingPdfMaker::histo, i, getDQMSummary::iter, j, LogDebug, NULL, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, tkhisto, and tkMap.

29  {
30 
31  tkMap=new TrackerMap( "DigiOcc" );
32  tkhisto=new TkHistoMap("DigiOcc","DigiOcc",-1.);
33 
34  //******************************
35  //Get DetCabling to translate the DQM TProfile in TkMaps
36 
38  es.get<SiStripDetCablingRcd>().get(tkmechstruct);
39 
40  // get list of active detectors from SiStripDetCabling
41  std::vector<uint32_t> activeDets;
42  activeDets.clear(); // just in case
43  tkmechstruct->addActiveDetectorsRawIds(activeDets);
44  SiStripSubStructure substructure;
45 
46  std::vector<uint32_t> SelectedDetIds[34];
47  size_t i=0;
48 
49  //i=0-3
50  for(size_t j=1;j<5;j++)
51  substructure.getTIBDetectors(activeDets,SelectedDetIds[i++],j,0,0,0);
52 
53  //i=4-9
54  for(size_t j=1;j<7;j++)
55  substructure.getTOBDetectors(activeDets,SelectedDetIds[i++],j,0,0);
56 
57  //i=10-12
58  for(size_t j=1;j<4;j++)
59  substructure.getTIDDetectors(activeDets,SelectedDetIds[i++],1,j,0,0);
60 
61  //i=13-15
62  for(size_t j=1;j<4;j++)
63  substructure.getTIDDetectors(activeDets,SelectedDetIds[i++],2,j,0,0);
64 
65  //i=16-24
66  for(size_t j=1;j<10;j++)
67  substructure.getTECDetectors(activeDets,SelectedDetIds[i++],1,j,0,0,0,0);
68 
69  //i=25-33
70  for(size_t j=1;j<10;j++)
71  substructure.getTECDetectors(activeDets,SelectedDetIds[i++],2,j,0,0,0,0);
72 
73  //******************************
74 
75 
76  //**********************
77  // Get ME from the DQM root file and search for interesting histograms
78 
79  edm::LogInfo("SiStripDQMProfileToTkMapConverter") <<" [SiStripDQMProfileToTkMapConverter] dirpath " << dirpath << std::endl;
80 
81  std::vector<MonitorElement*> MEs = dqmStore_->getAllContents(dirpath);
82 
83  edm::LogInfo("SiStripQualityHotStripIdentifierRoot") <<" [SiStripQualityHotStripIdentifierRoot::bookHistos] vector size " << MEs.size()<< std::endl;
84 
85  std::vector<MonitorElement*>::const_iterator iter=MEs.begin();
86  std::vector<MonitorElement*>::const_iterator iterEnd=MEs.end();
87 
88  std::stringstream ssFull, ssReport;
89 
90  const TProfile* histo;
91  size_t layerIdx;
92  for (; iter!=iterEnd;++iter) {
93  std::string me_name = (*iter)->getName();
94 
95  if (strstr(me_name.c_str(),"NumberOfDigiProfile__")==NULL)
96  continue;
97 
98  ssFull << me_name.c_str() << std::endl;
99  layerIdx=0;
100 
101  std::stringstream ss;
102  if(strstr(me_name.c_str(),"TIB")!=NULL){
103  ss<<strstr(me_name.c_str(), "layer__")[7];
104  ssReport << "\nTIB Layer " << ss.str() << "\n";
105  layerIdx=atoi(ss.str().c_str());
106  }else if(strstr(me_name.c_str(),"TOB")!=NULL){
107  ss<<strstr(me_name.c_str(), "layer__")[7];
108  layerIdx=atoi(ss.str().c_str())+4;
109  ssReport << "\nTOB Layer " << ss.str() << "\n";
110  }else if(strstr(me_name.c_str(),"TID")!=NULL){
111  ss<<strstr(me_name.c_str(), "wheel__")[7];
112  layerIdx=atoi(ss.str().c_str())+10;
113  if(strstr(me_name.c_str(),"side__2")!=NULL){
114  layerIdx+=3;
115  }
116  ssReport << "\nTID Disk " << ss.str() << "\n";
117  }else if(strstr(me_name.c_str(),"TEC")!=NULL){
118  ss<<strstr(me_name.c_str(), "wheel__")[7];
119  layerIdx=atoi(ss.str().c_str())+16;
120  if(strstr(me_name.c_str(),"side__2")!=NULL){
121  layerIdx+=9;
122  }
123  ssReport << "\nTEC Wheel " << ss.str() << "\n";
124  }
125 
126  std::cout << ss.str() << " " << layerIdx << " selected dets size " << SelectedDetIds[layerIdx-1].size()<< std::endl;
127 
128  if(layerIdx!=0){
129  histo= (TProfile *) (*(*iter)).getTProfile();
130  for(int ibin=1;ibin<histo->GetNbinsX();++ibin){
131  ssFull << layerIdx << " " << ibin << " " << SelectedDetIds[layerIdx-1][ibin-1] << " " << histo->GetBinContent(ibin) << std::endl;
132  tkMap->fill(SelectedDetIds[layerIdx-1][ibin-1],1/(histo->GetBinContent(ibin)+0.0000001));
133  tkhisto->fill(SelectedDetIds[layerIdx-1][ibin-1],1/(histo->GetBinContent(ibin)+0.0000001));
134 
135  if(histo->GetBinContent(ibin)==0)
136  ssReport << "\t" << layerIdx << " \t " << ibin << " \t " << SelectedDetIds[layerIdx-1][ibin-1] << std::endl;
137  }
138  }
139  }
140  LogDebug("SiStripDQMProfileToTkMapConverter") <<" [SiStripDQMProfileToTkMapConverter] fullPrint " << ssFull.str() << std::endl;
141  edm::LogInfo("SiStripDQMProfileToTkMapConverter") <<" [SiStripDQMProfileToTkMapConverter] fullPrint " << ssReport.str() << std::endl;
142 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
TProfile * getTProfile(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
#define NULL
Definition: scimark2.h:8
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:1931
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0) const
void fill(uint32_t &detid, float value)
Definition: TkHistoMap.cc:180
int j
Definition: DBlmapReader.cc:9
const T & get() const
Definition: EventSetup.h:55
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0) const
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0) const
tuple cout
Definition: gather_cfg.py:121
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0) const
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:2776
void SiStripDQMProfileToTkMapConverter::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file SiStripDQMProfileToTkMapConverter.cc.

References conf_, filename, edm::ParameterSet::getUntrackedParameter(), TkHistoMap::save(), TrackerMap::save(), TkHistoMap::saveAsCanvas(), AlCaHLTBitMon_QueryRunRegistry::string, tkhisto, tkMap, and TkMapFileName_.

144  {
145 
147  if (filename!=""){
148  edm::LogInfo("SiStripDQMProfileToTkMapConverter") <<" [SiStripDQMProfileToTkMapConverter] endJob Saving.........." << std::endl;
149  tkMap->save(false,0,0,filename.c_str());
150  filename.erase(filename.begin()+filename.find("."),filename.end());
151  tkhisto->save(filename+".root");
152  tkhisto->saveAsCanvas(filename+"_Canvas.root",conf_.getUntrackedParameter<std::string>("TkMapDrawOption","E"));
153  }
154 
155 }
T getUntrackedParameter(std::string const &, T const &) const
void saveAsCanvas(std::string filename, std::string options="", std::string mode="RECREATE")
Definition: TkHistoMap.cc:252
void save(std::string filename)
Definition: TkHistoMap.cc:57
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:698

Member Data Documentation

const edm::ParameterSet SiStripDQMProfileToTkMapConverter::conf_
private

Definition at line 42 of file SiStripDQMProfileToTkMapConverter.h.

Referenced by endJob().

std::string SiStripDQMProfileToTkMapConverter::dirpath
private
DQMStore* SiStripDQMProfileToTkMapConverter::dqmStore_
private
std::string SiStripDQMProfileToTkMapConverter::filename
private
edm::FileInPath SiStripDQMProfileToTkMapConverter::fp_
private
SiStripDetInfoFileReader* SiStripDQMProfileToTkMapConverter::reader
private
TkHistoMap* SiStripDQMProfileToTkMapConverter::tkhisto
private

Definition at line 51 of file SiStripDQMProfileToTkMapConverter.h.

Referenced by beginRun(), and endJob().

TrackerMap* SiStripDQMProfileToTkMapConverter::tkMap
private

Definition at line 52 of file SiStripDQMProfileToTkMapConverter.h.

Referenced by beginRun(), and endJob().

std::string SiStripDQMProfileToTkMapConverter::TkMapFileName_
private

Definition at line 46 of file SiStripDQMProfileToTkMapConverter.h.

Referenced by endJob().