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
AnaMuonCaloCleaner Class Reference
Inheritance diagram for AnaMuonCaloCleaner:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 AnaMuonCaloCleaner (const edm::ParameterSet &)
 
 ~AnaMuonCaloCleaner ()
 
- 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
 
typedef std::map< std::string,
TTree * > 
TTreeMap
 
typedef std::map< std::string,
std::map< std::string, float > > 
TTreeTempStorageMap
 

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_
 
THistoMap histoMap_
 
TMySubMap subDetMap_
 
TTreeMap treeMap_
 
TTreeTempStorageMap treeStorageMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 AnaMuonCaloCleaner.cc.

Member Typedef Documentation

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

Definition at line 77 of file AnaMuonCaloCleaner.cc.

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

Definition at line 75 of file AnaMuonCaloCleaner.cc.

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

Definition at line 76 of file AnaMuonCaloCleaner.cc.

typedef std::map<std::string, TTree * > AnaMuonCaloCleaner::TTreeMap
private

Definition at line 84 of file AnaMuonCaloCleaner.cc.

typedef std::map<std::string, std::map<std::string, float> > AnaMuonCaloCleaner::TTreeTempStorageMap
private

Definition at line 85 of file AnaMuonCaloCleaner.cc.

Constructor & Destructor Documentation

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

Definition at line 103 of file AnaMuonCaloCleaner.cc.

References detMap_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalLaserPnDiode, EcalPreshower, EcalTriggerTower, getAllKeys(), DetId::Hcal, HcalBarrel, HcalEmpty, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, histoMap_, relativeConstraints::keys, TFileService::make(), mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, subDetMap_, treeMap_, and treeStorageMap_.

103  :
104  colLen_(iConfig.getParameter<edm::InputTag>("colLen")),
105  colDep_(iConfig.getParameter<edm::InputTag>("colDep")),
106  _inputCol(iConfig.getParameter<edm::InputTag>("selectedMuons")),
107  charge_(iConfig.getParameter<int>("charge"))
108 {
109 
110  detMap_[DetId::Hcal]="Hcal";
111  detMap_[DetId::Ecal]="Ecal";
112 
113  subDetMap_[DetId::Ecal][EcalBarrel]="EcalBarrel";
114  subDetMap_[DetId::Ecal][EcalEndcap]="EcalEndcap";
115  subDetMap_[DetId::Ecal][EcalPreshower ]="EcalPreshower";
116  subDetMap_[DetId::Ecal][EcalTriggerTower]="EcalTriggerTower";
117  subDetMap_[DetId::Ecal][EcalLaserPnDiode]="EcalLaserPnDiode";
118 
119  subDetMap_[DetId::Hcal][HcalEmpty]="HcalEmpty";
120  subDetMap_[DetId::Hcal][HcalBarrel]="HcalBarrel";
121  subDetMap_[DetId::Hcal][HcalEndcap]="HcalEndcap";
122  subDetMap_[DetId::Hcal][HcalOuter]="HcalOuter";
123  subDetMap_[DetId::Hcal][HcalForward]="HcalForward";
124  subDetMap_[DetId::Hcal][HcalTriggerTower]="HcalTriggerTower";
125  subDetMap_[DetId::Hcal][HcalOther]="HcalOther";
126 
127 
128  std::vector<std::string> keys = getAllKeys();
130  BOOST_FOREACH(std::string & name, keys){
131  histoMap_[name]=fs->make<TH2F>( name.c_str() , name.c_str(), 1000, 0., 200., 1000, 0, 20. );
132  std::string treeName = "tree_" +name ;
133  treeMap_[name]=fs->make<TTree>( treeName.c_str() , treeName.c_str());
134 
135  treeStorageMap_[name]["pt"] = -999;
136  treeStorageMap_[name]["p"] = -999;
137  treeStorageMap_[name]["eta"] = -999;
138  treeStorageMap_[name]["phi"] = -999;
139  treeStorageMap_[name]["len"] = -999;
140  treeStorageMap_[name]["val"] = -999;
141  treeStorageMap_[name]["charge"] = -999;
142 
143  BOOST_FOREACH(TTreeTempStorageMap::mapped_type::value_type & entry, treeStorageMap_[name] ){
144  treeMap_[name]->Branch(entry.first.c_str(), &entry.second);
145  }
146  }
147 
148  // TTreeMap treeMap_;
149  //TTreeTempStorageMap treeStorageMap_;
150 }
T getParameter(std::string const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::vector< std::string > getAllKeys()
Container::value_type value_type
TTreeTempStorageMap treeStorageMap_
AnaMuonCaloCleaner::~AnaMuonCaloCleaner ( )

Definition at line 231 of file AnaMuonCaloCleaner.cc.

232 {
233 
234  // do anything here that needs to be done at desctruction time
235  // (e.g. close files, deallocate resources etc.)
236 
237 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 154 of file AnaMuonCaloCleaner.cc.

References _inputCol, reco::LeafCandidate::charge(), charge_, colDep_, colLen_, reco::LeafCandidate::eta(), edm::Event::getByLabel(), getKey(), histoMap_, reco::Muon::isGlobalMuon(), RPCpg::mu, mergeVDriftHistosByStation::name, reco::LeafCandidate::p(), reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), edm::second(), AlCaHLTBitMon_QueryRunRegistry::string, treeMap_, and treeStorageMap_.

155 {
156 
157  //std::cout << "------------------------------\n";
159  iEvent.getByLabel(_inputCol, muonsHandle);
160 
161  const reco::Muon * myMu = 0;
162  BOOST_FOREACH(const reco::Muon & mu, *muonsHandle){
163  if (!mu.isGlobalMuon()) continue;
164  if (mu.charge()!= charge_) continue;
165  myMu = &mu;
166  break;
167  }
168 
169  if (myMu==0){
170  // std::cout << " XXX AnaMuonCaloCleaner says whoooops" << std::endl;
171  return;
172  }
173 
174  typedef std::map<unsigned int,float> TMyCol;
175  edm::Handle< TMyCol > hLenghts;
176  edm::Handle< TMyCol > hDeposits;
177 
178 
179  iEvent.getByLabel(colLen_,hLenghts);
180  iEvent.getByLabel(colDep_,hDeposits);
181 
182 
183  BOOST_FOREACH(const TMyCol::value_type & entry, *hLenghts){
184  DetId det(entry.first);
185  float len = entry.second;
186  float val = 0;
187  std::string name =getKey(det);
188  if (hDeposits->find(entry.first) != hDeposits->end())
189  val = (hDeposits->find(entry.first))->second;
190  //else
191  // std::cout << "Whoops! empty "<< len << " " << name << std::endl;
192 
193  //std::cout << "XX " << name << " " << det.rawId() << " " << len << " " << val << std::endl;
194  histoMap_[name]->Fill(len,val);
195  treeStorageMap_[name]["pt"] = myMu->pt();
196  treeStorageMap_[name]["p"] = myMu->p();
197  treeStorageMap_[name]["eta"] = myMu->eta();
198  treeStorageMap_[name]["phi"] = myMu->phi();
199  treeStorageMap_[name]["len"] = len;
200  treeStorageMap_[name]["val"] = val;
201  treeStorageMap_[name]["charge"] = myMu->charge();
202  treeMap_[name]->Fill();
203  }
204 
205  // edm::SortedCollection<EcalRecHit,edm::StrictWeakOrdering<EcalRecHit> > "ecalRecHit" "EcalRecHitsEE" "HLT" EcalRecHitsSorted_ecalRecHit_EcalRecHitsEE_HLT
206 
207 
208 
209 }
virtual double p() const
magnitude of momentum vector
bool isGlobalMuon() const
Definition: Muon.h:218
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
U second(std::pair< T, U > const &p)
std::string getKey(const DetId &det)
virtual int charge() const
electric charge
Definition: LeafCandidate.h:91
const int mu
Definition: Constants.h:22
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
Definition: DetId.h:18
TTreeTempStorageMap treeStorageMap_
virtual double phi() const
momentum azimuthal angle
void AnaMuonCaloCleaner::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 249 of file AnaMuonCaloCleaner.cc.

250 {
251 }
void AnaMuonCaloCleaner::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 274 of file AnaMuonCaloCleaner.cc.

275 {
276 }
void AnaMuonCaloCleaner::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 262 of file AnaMuonCaloCleaner.cc.

263 {
264 }
void AnaMuonCaloCleaner::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 255 of file AnaMuonCaloCleaner.cc.

256 {
257 
258 }
void AnaMuonCaloCleaner::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 280 of file AnaMuonCaloCleaner.cc.

281 {
282 }
void AnaMuonCaloCleaner::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 268 of file AnaMuonCaloCleaner.cc.

269 {
270 }
void AnaMuonCaloCleaner::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 286 of file AnaMuonCaloCleaner.cc.

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

286  {
287  //The following says we do not know what parameters are allowed so do no validation
288  // Please change this to state exactly what you do use, even if it is no parameters
290  desc.setUnknown();
291  descriptions.addDefault(desc);
292 }
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< std::string > AnaMuonCaloCleaner::getAllKeys ( )
private

Definition at line 216 of file AnaMuonCaloCleaner.cc.

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

Referenced by AnaMuonCaloCleaner().

216  {
217  std::vector<std::string> ret;
218  ret.push_back("H__");
219  BOOST_FOREACH(TMyMainMap::value_type & entry, detMap_){
220  BOOST_FOREACH(TMySubMap::mapped_type::value_type & subEntry, subDetMap_[entry.first]){
221  std::string name = "H_"+entry.second+"_"+subEntry.second;
222  //std::cout << "XX " << name << std::endl;
223  ret.push_back(name);
224  }
225 
226  }
227 
228  return ret;
229 }
Container::value_type value_type
std::string AnaMuonCaloCleaner::getKey ( const DetId det)
private

Definition at line 212 of file AnaMuonCaloCleaner.cc.

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

Referenced by analyze().

212  {
213  return "H_"+detMap_[det.det()]+"_"+subDetMap_[det.det()][det.subdetId()];
214 }
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 AnaMuonCaloCleaner::_inputCol
private

Definition at line 68 of file AnaMuonCaloCleaner.cc.

Referenced by analyze().

int AnaMuonCaloCleaner::charge_
private

Definition at line 69 of file AnaMuonCaloCleaner.cc.

Referenced by analyze().

edm::InputTag AnaMuonCaloCleaner::colDep_
private

Definition at line 67 of file AnaMuonCaloCleaner.cc.

Referenced by analyze().

edm::InputTag AnaMuonCaloCleaner::colLen_
private

Definition at line 66 of file AnaMuonCaloCleaner.cc.

Referenced by analyze().

TMyMainMap AnaMuonCaloCleaner::detMap_
private

Definition at line 81 of file AnaMuonCaloCleaner.cc.

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

THistoMap AnaMuonCaloCleaner::histoMap_
private

Definition at line 80 of file AnaMuonCaloCleaner.cc.

Referenced by analyze(), and AnaMuonCaloCleaner().

TMySubMap AnaMuonCaloCleaner::subDetMap_
private

Definition at line 82 of file AnaMuonCaloCleaner.cc.

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

TTreeMap AnaMuonCaloCleaner::treeMap_
private

Definition at line 86 of file AnaMuonCaloCleaner.cc.

Referenced by analyze(), and AnaMuonCaloCleaner().

TTreeTempStorageMap AnaMuonCaloCleaner::treeStorageMap_
private

Definition at line 87 of file AnaMuonCaloCleaner.cc.

Referenced by analyze(), and AnaMuonCaloCleaner().