CMS 3D CMS Logo

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

Public Member Functions

 TestMuonCaloCleaner (const edm::ParameterSet &)
 
 ~TestMuonCaloCleaner ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Types

typedef std::map< std::string,
TH2F * > 
THistoMap
 
typedef std::map< int,
std::string > 
TMyMainMap
 
typedef std::map< int,
std::map< int, std::string > > 
TMySubMap
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
std::vector< std::string > getAllKeys ()
 
std::string getKey (const DetId &det)
 

Private Attributes

edm::InputTag _inputCol
 
int charge_
 
edm::InputTag colDep_
 
edm::InputTag colLen_
 
TMyMainMap detMap_
 
TMySubMap subDetMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 49 of file TestMuonCaloCleaner.cc.

Member Typedef Documentation

typedef std::map<std::string, TH2F * > TestMuonCaloCleaner::THistoMap
private

Definition at line 77 of file TestMuonCaloCleaner.cc.

typedef std::map<int, std::string > TestMuonCaloCleaner::TMyMainMap
private

Definition at line 75 of file TestMuonCaloCleaner.cc.

typedef std::map<int, std::map<int, std::string> > TestMuonCaloCleaner::TMySubMap
private

Definition at line 76 of file TestMuonCaloCleaner.cc.

Constructor & Destructor Documentation

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

Definition at line 98 of file TestMuonCaloCleaner.cc.

References detMap_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalLaserPnDiode, EcalPreshower, EcalTriggerTower, DetId::Hcal, HcalBarrel, HcalEmpty, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, and subDetMap_.

98  :
99  colLen_(iConfig.getParameter<edm::InputTag>("colLen")),
100  colDep_(iConfig.getParameter<edm::InputTag>("colDep")),
101  _inputCol(iConfig.getParameter<edm::InputTag>("selectedMuons")),
102  charge_(iConfig.getParameter<int>("charge"))
103 {
104 
105  detMap_[DetId::Hcal]="Hcal";
106  detMap_[DetId::Ecal]="Ecal";
107 
108  subDetMap_[DetId::Ecal][EcalBarrel]="EcalBarrel";
109  subDetMap_[DetId::Ecal][EcalEndcap]="EcalEndcap";
110  subDetMap_[DetId::Ecal][EcalPreshower ]="EcalPreshower";
111  subDetMap_[DetId::Ecal][EcalTriggerTower]="EcalTriggerTower";
112  subDetMap_[DetId::Ecal][EcalLaserPnDiode]="EcalLaserPnDiode";
113 
114  subDetMap_[DetId::Hcal][HcalEmpty]="HcalEmpty";
115  subDetMap_[DetId::Hcal][HcalBarrel]="HcalBarrel";
116  subDetMap_[DetId::Hcal][HcalEndcap]="HcalEndcap";
117  subDetMap_[DetId::Hcal][HcalOuter]="HcalOuter";
118  subDetMap_[DetId::Hcal][HcalForward]="HcalForward";
119  subDetMap_[DetId::Hcal][HcalTriggerTower]="HcalTriggerTower";
120  subDetMap_[DetId::Hcal][HcalOther]="HcalOther";
121 
122 
123 }
T getParameter(std::string const &) const
TestMuonCaloCleaner::~TestMuonCaloCleaner ( )

Definition at line 212 of file TestMuonCaloCleaner.cc.

213 {
214 
215  // do anything here that needs to be done at desctruction time
216  // (e.g. close files, deallocate resources etc.)
217 
218 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 127 of file TestMuonCaloCleaner.cc.

References _inputCol, reco::LeafCandidate::charge(), charge_, colDep_, colLen_, gather_cfg::cout, EcalRecHit::energy(), edm::Event::getByLabel(), getKey(), EcalRecHit::id(), reco::Muon::isGlobalMuon(), RPCpg::mu, mergeVDriftHistosByStation::name, DetId::rawId(), edm::second(), and AlCaHLTBitMon_QueryRunRegistry::string.

128 {
129 
130  //std::cout << "------------------------------\n";
132  iEvent.getByLabel(_inputCol, muonsHandle);
133 
134  const reco::Muon * myMu = 0;
135  BOOST_FOREACH(const reco::Muon & mu, *muonsHandle){
136  if (!mu.isGlobalMuon()) continue;
137  if (mu.charge()!= charge_) continue;
138  myMu = &mu;
139  break;
140  }
141 
142  if (myMu==0){
143  // std::cout << " XXX TestMuonCaloCleaner says whoooops" << std::endl;
144  return;
145  }
146 
147  typedef std::map<unsigned int,float> TMyCol;
148  edm::Handle< TMyCol > hLenghts;
149  edm::Handle< TMyCol > hDeposits;
150 
151 
152  iEvent.getByLabel(colLen_,hLenghts);
153  iEvent.getByLabel(colDep_,hDeposits);
154 
155  unsigned int selectedDet = 0;
156 
157  BOOST_FOREACH(const TMyCol::value_type & entry, *hLenghts){
158  DetId det(entry.first);
159  float len = entry.second;
160  float val = 0;
161  std::string name =getKey(det);
162  if (hDeposits->find(entry.first) != hDeposits->end())
163  val = (hDeposits->find(entry.first))->second;
164  else if (name == "H_Ecal_EcalEndcap") {
165  //std::cout << " nm " << name << std::endl;
166  selectedDet = entry.first;
167  }
168 
169  const bool fDebug = false;
170  if(fDebug)
171  std::cout << "XX " << name << " " << det.rawId() << " " << len << " " << val << std::endl;
172  }
173 
174  if (selectedDet != 0) {
175  //std::cout << "TT"<<std::endl;
177  iEvent.getByLabel(edm::InputTag( "ecalRecHit", "EcalRecHitsEE"), hEErh );
178 
179  BOOST_FOREACH(const EcalRecHit & rh, *hEErh){
180 
181  //std::cout << " " << rh.energy() << std::endl;
182  //DetId det(selectedDet);
183 
184  if ( selectedDet == rh.id().rawId() ) {
185  std::cout << selectedDet << " " << rh.energy() << std::endl;
186  }
187  }
188 
189  }
190 }
bool isGlobalMuon() const
Definition: Muon.h:218
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
U second(std::pair< T, U > const &p)
std::string getKey(const DetId &det)
virtual int charge() const
electric charge
Definition: LeafCandidate.h:91
float energy() const
Definition: EcalRecHit.h:68
const int mu
Definition: Constants.h:22
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
Definition: DetId.h:18
DetId id() const
get the id
Definition: EcalRecHit.h:76
tuple cout
Definition: gather_cfg.py:121
void TestMuonCaloCleaner::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 230 of file TestMuonCaloCleaner.cc.

231 {
232 }
void TestMuonCaloCleaner::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 255 of file TestMuonCaloCleaner.cc.

256 {
257 }
void TestMuonCaloCleaner::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 243 of file TestMuonCaloCleaner.cc.

244 {
245 }
void TestMuonCaloCleaner::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 236 of file TestMuonCaloCleaner.cc.

237 {
238 
239 }
void TestMuonCaloCleaner::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 261 of file TestMuonCaloCleaner.cc.

262 {
263 }
void TestMuonCaloCleaner::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 249 of file TestMuonCaloCleaner.cc.

250 {
251 }
void TestMuonCaloCleaner::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 267 of file TestMuonCaloCleaner.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

267  {
268  //The following says we do not know what parameters are allowed so do no validation
269  // Please change this to state exactly what you do use, even if it is no parameters
271  desc.setUnknown();
272  descriptions.addDefault(desc);
273 }
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< std::string > TestMuonCaloCleaner::getAllKeys ( )
private

Definition at line 197 of file TestMuonCaloCleaner.cc.

References detMap_, mergeVDriftHistosByStation::name, run_regression::ret, AlCaHLTBitMon_QueryRunRegistry::string, and subDetMap_.

197  {
198  std::vector<std::string> ret;
199  ret.push_back("H__");
200  BOOST_FOREACH(TMyMainMap::value_type & entry, detMap_){
201  BOOST_FOREACH(TMySubMap::mapped_type::value_type & subEntry, subDetMap_[entry.first]){
202  std::string name = "H_"+entry.second+"_"+subEntry.second;
203  //std::cout << "XX " << name << std::endl;
204  ret.push_back(name);
205  }
206 
207  }
208 
209  return ret;
210 }
Container::value_type value_type
std::string TestMuonCaloCleaner::getKey ( const DetId det)
private

Definition at line 193 of file TestMuonCaloCleaner.cc.

References DetId::det(), detMap_, DetId::subdetId(), and subDetMap_.

Referenced by analyze().

193  {
194  return "H_"+detMap_[det.det()]+"_"+subDetMap_[det.det()][det.subdetId()];
195 }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Detector det() const
get the detector field from this detid
Definition: DetId.h:35

Member Data Documentation

edm::InputTag TestMuonCaloCleaner::_inputCol
private

Definition at line 68 of file TestMuonCaloCleaner.cc.

Referenced by analyze().

int TestMuonCaloCleaner::charge_
private

Definition at line 69 of file TestMuonCaloCleaner.cc.

Referenced by analyze().

edm::InputTag TestMuonCaloCleaner::colDep_
private

Definition at line 67 of file TestMuonCaloCleaner.cc.

Referenced by analyze().

edm::InputTag TestMuonCaloCleaner::colLen_
private

Definition at line 66 of file TestMuonCaloCleaner.cc.

Referenced by analyze().

TMyMainMap TestMuonCaloCleaner::detMap_
private

Definition at line 80 of file TestMuonCaloCleaner.cc.

Referenced by getAllKeys(), getKey(), and TestMuonCaloCleaner().

TMySubMap TestMuonCaloCleaner::subDetMap_
private

Definition at line 81 of file TestMuonCaloCleaner.cc.

Referenced by getAllKeys(), getKey(), and TestMuonCaloCleaner().