#include <CaloOnlineTools/EcalTools/plugins/EcalURecHitHists.h>
Public Member Functions | |
EcalURecHitHists (const edm::ParameterSet &) | |
~EcalURecHitHists () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
void | initHists (int) |
std::string | intToString (int num) |
Private Attributes | |
TH1F * | allFedsHist_ |
TH1F * | allFedsTimingHist_ |
edm::InputTag | EBUncalibratedRecHitCollection_ |
const EcalElectronicsMapping * | ecalElectronicsMap_ |
edm::InputTag | EEUncalibratedRecHitCollection_ |
EcalFedMap * | fedMap_ |
std::map< int, TH1F * > | FEDsAndHists_ |
std::map< int, TH1F * > | FEDsAndTimingHists_ |
TFile * | file |
std::string | fileName_ |
double | histRangeMax_ |
double | histRangeMin_ |
std::vector< int > | maskedChannels_ |
std::vector< std::string > | maskedEBs_ |
std::vector< int > | maskedFEDs_ |
int | runNum_ |
Implementation: <Notes on="" implementation>="">
Definition at line 56 of file EcalURecHitHists.h.
EcalURecHitHists::EcalURecHitHists | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 37 of file EcalURecHitHists.cc.
References allFedsHist_, allFedsTimingHist_, fedMap_, edm::ParameterSet::getUntrackedParameter(), histRangeMax_, histRangeMin_, int, maskedChannels_, maskedEBs_, and maskedFEDs_.
00037 : 00038 EBUncalibratedRecHitCollection_ (iConfig.getParameter<edm::InputTag>("EBUncalibratedRecHitCollection")), 00039 EEUncalibratedRecHitCollection_ (iConfig.getParameter<edm::InputTag>("EEUncalibratedRecHitCollection")), 00040 runNum_(-1), 00041 histRangeMax_ (iConfig.getUntrackedParameter<double>("histogramMaxRange",200.0)), 00042 histRangeMin_ (iConfig.getUntrackedParameter<double>("histogramMinRange",-10.0)), 00043 fileName_ (iConfig.getUntrackedParameter<std::string>("fileName", std::string("ecalURechHitHists"))) 00044 { 00045 vector<int> listDefaults; 00046 listDefaults.push_back(-1); 00047 00048 maskedChannels_ = iConfig.getUntrackedParameter<vector<int> >("maskedChannels", listDefaults); 00049 maskedFEDs_ = iConfig.getUntrackedParameter<vector<int> >("maskedFEDs", listDefaults); 00050 00051 vector<string> defaultMaskedEBs; 00052 defaultMaskedEBs.push_back("none"); 00053 maskedEBs_ = iConfig.getUntrackedParameter<vector<string> >("maskedEBs",defaultMaskedEBs); 00054 00055 fedMap_ = new EcalFedMap(); 00056 string title1 = "Uncalib Rec Hits (ADC counts)"; 00057 string name1 = "URecHitsAllFEDs"; 00058 int numBins = (int)round(histRangeMax_-histRangeMin_)+1; 00059 allFedsHist_ = new TH1F(name1.c_str(),title1.c_str(),numBins,histRangeMin_,histRangeMax_); 00060 title1 = "Jitter for all FEDs"; 00061 name1 = "JitterAllFEDs"; 00062 allFedsTimingHist_ = new TH1F(name1.c_str(),title1.c_str(),14,-7,7); 00063 00064 // load up the maskedFED list with the proper FEDids 00065 if(maskedFEDs_[0]==-1) 00066 { 00067 //if "actual" EB id given, then convert to FEDid and put in listFEDs_ 00068 if(maskedEBs_[0] != "none") 00069 { 00070 maskedFEDs_.clear(); 00071 for(vector<string>::const_iterator ebItr = maskedEBs_.begin(); ebItr != maskedEBs_.end(); ++ebItr) 00072 { 00073 maskedFEDs_.push_back(fedMap_->getFedFromSlice(*ebItr)); 00074 } 00075 } 00076 } 00077 }
EcalURecHitHists::~EcalURecHitHists | ( | ) |
void EcalURecHitHists::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 91 of file EcalURecHitHists.cc.
References allFedsHist_, allFedsTimingHist_, EcalUncalibratedRecHit::amplitude(), EcalElectronicsId::dccId(), EBUncalibratedRecHitCollection_, ecalElectronicsMap_, EEUncalibratedRecHitCollection_, edm::EventID::event(), L1Comparator_cfi::FEDid, FEDsAndHists_, FEDsAndTimingHists_, find(), edm::Event::getByLabel(), EcalElectronicsMapping::getElectronicsId(), EEDetId::hashedIndex(), EBDetId::hashedIndex(), EEDetId::ic(), EBDetId::ic(), EcalUncalibratedRecHit::id(), edm::Event::id(), initHists(), EcalUncalibratedRecHit::jitter(), LogDebug, maskedChannels_, maskedFEDs_, HLT_VtxMuL3::result, edm::EventID::run(), and runNum_.
00092 { 00093 int ievt = iEvent.id().event(); 00094 Handle<EcalUncalibratedRecHitCollection> EBhits; 00095 Handle<EcalUncalibratedRecHitCollection> EEhits; 00096 00097 iEvent.getByLabel(EBUncalibratedRecHitCollection_, EBhits); 00098 LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EBhits->size(); 00099 00100 iEvent.getByLabel(EEUncalibratedRecHitCollection_, EEhits); 00101 LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EEhits->size(); 00102 00103 for (EcalUncalibratedRecHitCollection::const_iterator hitItr = EBhits->begin(); hitItr != EBhits->end(); ++hitItr) 00104 { 00105 EcalUncalibratedRecHit hit = (*hitItr); 00106 EBDetId ebDet = hit.id(); 00107 int ic = ebDet.ic(); 00108 int hashedIndex = ebDet.hashedIndex(); 00109 EcalElectronicsId elecId = ecalElectronicsMap_->getElectronicsId(ebDet); 00110 int FEDid = 600+elecId.dccId(); 00111 float ampli = hit.amplitude(); 00112 00113 vector<int>::iterator result; 00114 result = find(maskedFEDs_.begin(), maskedFEDs_.end(), FEDid); 00115 if(result != maskedFEDs_.end()) 00116 { 00117 LogWarning("EcalURecHitHists") << "skipping uncalRecHit for FED " << FEDid << " ; amplitude " << ampli; 00118 continue; 00119 } 00120 00121 result = find(maskedChannels_.begin(), maskedChannels_.end(), hashedIndex); 00122 if (result != maskedChannels_.end()) 00123 { 00124 LogWarning("EcalURecHitHists") << "skipping uncalRecHit for channel: " << ic << " with amplitude " << ampli ; 00125 continue; 00126 } 00127 00128 // fill the proper hist 00129 TH1F* uRecHist = FEDsAndHists_[FEDid]; 00130 TH1F* timingHist = FEDsAndTimingHists_[FEDid]; 00131 if(uRecHist==0) 00132 { 00133 initHists(FEDid); 00134 uRecHist = FEDsAndHists_[FEDid]; 00135 timingHist = FEDsAndTimingHists_[FEDid]; 00136 } 00137 00138 uRecHist->Fill(ampli); 00139 allFedsHist_->Fill(ampli); 00140 timingHist->Fill(hit.jitter()); 00141 allFedsTimingHist_->Fill(hit.jitter()); 00142 } 00143 00144 // Again for the endcap 00145 for (EcalUncalibratedRecHitCollection::const_iterator hitItr = EEhits->begin(); hitItr != EEhits->end(); ++hitItr) 00146 { 00147 EcalUncalibratedRecHit hit = (*hitItr); 00148 EEDetId eeDet = hit.id(); 00149 int ic = eeDet.ic(); 00150 int hashedIndex = eeDet.hashedIndex(); 00151 EcalElectronicsId elecId = ecalElectronicsMap_->getElectronicsId(eeDet); 00152 int FEDid = 600+elecId.dccId(); 00153 float ampli = hit.amplitude(); 00154 00155 vector<int>::iterator result; 00156 result = find(maskedFEDs_.begin(), maskedFEDs_.end(), FEDid); 00157 if(result != maskedFEDs_.end()) 00158 { 00159 LogWarning("EcalURecHitHists") << "skipping uncalRecHit for FED " << FEDid << " ; amplitude " << ampli; 00160 continue; 00161 } 00162 00163 result = find(maskedChannels_.begin(), maskedChannels_.end(), hashedIndex); 00164 if (result != maskedChannels_.end()) 00165 { 00166 LogWarning("EcalURecHitHists") << "skipping uncalRecHit for channel: " << ic << " with amplitude " << ampli ; 00167 continue; 00168 } 00169 00170 // fill the proper hist 00171 TH1F* uRecHist = FEDsAndHists_[FEDid]; 00172 TH1F* timingHist = FEDsAndTimingHists_[FEDid]; 00173 if(uRecHist==0) 00174 { 00175 initHists(FEDid); 00176 uRecHist = FEDsAndHists_[FEDid]; 00177 timingHist = FEDsAndTimingHists_[FEDid]; 00178 } 00179 00180 uRecHist->Fill(ampli); 00181 allFedsHist_->Fill(ampli); 00182 timingHist->Fill(hit.jitter()); 00183 allFedsTimingHist_->Fill(hit.jitter()); 00184 } 00185 00186 if(runNum_==-1) 00187 { 00188 runNum_ = iEvent.id().run(); 00189 } 00190 }
void EcalURecHitHists::beginJob | ( | const edm::EventSetup & | c | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 219 of file EcalURecHitHists.cc.
References ecalElectronicsMap_, edm::EventSetup::get(), and edm::ESHandle< T >::product().
00220 { 00221 edm::ESHandle<EcalElectronicsMapping> elecHandle; 00222 c.get<EcalMappingRcd>().get(elecHandle); 00223 ecalElectronicsMap_ = elecHandle.product(); 00224 }
Reimplemented from edm::EDAnalyzer.
Definition at line 228 of file EcalURecHitHists.cc.
References allFedsHist_, allFedsTimingHist_, TestMuL1L2Filter_cff::cerr, dir, lat::endl(), fedMap_, FEDsAndHists_, FEDsAndTimingHists_, fileName_, EcalFedMap::getSliceFromFed(), intToString(), maskedChannels_, runNum_, and std.
00229 { 00230 using namespace std; 00231 fileName_ += "-"+intToString(runNum_)+".graph.root"; 00232 00233 TFile root_file_(fileName_.c_str() , "RECREATE"); 00234 00235 for(map<int,TH1F*>::const_iterator itr = FEDsAndHists_.begin(); 00236 itr != FEDsAndHists_.end(); ++itr) 00237 { 00238 string dir = fedMap_->getSliceFromFed(itr->first); 00239 TDirectory* FEDdir = gDirectory->mkdir(dir.c_str()); 00240 FEDdir->cd(); 00241 00242 TH1F* hist = itr->second; 00243 if(hist!=0) 00244 hist->Write(); 00245 else 00246 { 00247 cerr << "EcalPedHists: Error: This shouldn't happen!" << endl; 00248 } 00249 // Write out timing hist 00250 hist = FEDsAndTimingHists_[itr->first]; 00251 if(hist!=0) 00252 hist->Write(); 00253 else 00254 { 00255 cerr << "EcalPedHists: Error: This shouldn't happen!" << endl; 00256 } 00257 root_file_.cd(); 00258 } 00259 allFedsHist_->Write(); 00260 allFedsTimingHist_->Write(); 00261 root_file_.Close(); 00262 00263 std::string channels; 00264 for(std::vector<int>::const_iterator itr = maskedChannels_.begin(); 00265 itr != maskedChannels_.end(); ++itr) 00266 { 00267 channels+=intToString(*itr); 00268 channels+=","; 00269 } 00270 00271 LogWarning("EcalMipGraphs") << "Masked channels are: " << channels << " and that is all!"; 00272 }
Definition at line 194 of file EcalURecHitHists.cc.
References L1Comparator_cfi::FEDid, fedMap_, FEDsAndHists_, FEDsAndTimingHists_, EcalFedMap::getSliceFromFed(), histRangeMax_, histRangeMin_, int, intToString(), and std.
Referenced by analyze().
00195 { 00196 using namespace std; 00197 00198 string FEDid = intToString(FED); 00199 string title1 = "Uncalib Rec Hits (ADC counts) for "; 00200 title1.append(fedMap_->getSliceFromFed(FED)); 00201 string name1 = "URecHitsFED"; 00202 name1.append(intToString(FED)); 00203 int numBins = (int)round(histRangeMax_-histRangeMin_)+1; 00204 TH1F* hist = new TH1F(name1.c_str(),title1.c_str(), numBins, histRangeMin_, histRangeMax_); 00205 FEDsAndHists_[FED] = hist; 00206 FEDsAndHists_[FED]->SetDirectory(0); 00207 00208 title1 = "Jitter for "; 00209 title1.append(fedMap_->getSliceFromFed(FED)); 00210 name1 = "JitterFED"; 00211 name1.append(intToString(FED)); 00212 TH1F* timingHist = new TH1F(name1.c_str(),title1.c_str(),14,-7,7); 00213 FEDsAndTimingHists_[FED] = timingHist; 00214 FEDsAndTimingHists_[FED]->SetDirectory(0); 00215 }
std::string EcalURecHitHists::intToString | ( | int | num | ) | [private] |
Definition at line 275 of file EcalURecHitHists.cc.
Referenced by endJob(), and initHists().
00276 { 00277 using namespace std; 00278 ostringstream myStream; 00279 myStream << num << flush; 00280 return(myStream.str()); //returns the string form of the stringstream object 00281 }
TH1F* EcalURecHitHists::allFedsHist_ [private] |
Definition at line 83 of file EcalURecHitHists.h.
Referenced by analyze(), EcalURecHitHists(), and endJob().
TH1F* EcalURecHitHists::allFedsTimingHist_ [private] |
Definition at line 84 of file EcalURecHitHists.h.
Referenced by analyze(), EcalURecHitHists(), and endJob().
const EcalElectronicsMapping* EcalURecHitHists::ecalElectronicsMap_ [private] |
EcalFedMap* EcalURecHitHists::fedMap_ [private] |
Definition at line 87 of file EcalURecHitHists.h.
Referenced by EcalURecHitHists(), endJob(), and initHists().
std::map<int,TH1F*> EcalURecHitHists::FEDsAndHists_ [private] |
Definition at line 80 of file EcalURecHitHists.h.
Referenced by analyze(), endJob(), and initHists().
std::map<int,TH1F*> EcalURecHitHists::FEDsAndTimingHists_ [private] |
Definition at line 81 of file EcalURecHitHists.h.
Referenced by analyze(), endJob(), and initHists().
TFile* EcalURecHitHists::file [private] |
Definition at line 86 of file EcalURecHitHists.h.
std::string EcalURecHitHists::fileName_ [private] |
double EcalURecHitHists::histRangeMax_ [private] |
Definition at line 74 of file EcalURecHitHists.h.
Referenced by EcalURecHitHists(), and initHists().
double EcalURecHitHists::histRangeMin_ [private] |
Definition at line 74 of file EcalURecHitHists.h.
Referenced by EcalURecHitHists(), and initHists().
std::vector<int> EcalURecHitHists::maskedChannels_ [private] |
Definition at line 77 of file EcalURecHitHists.h.
Referenced by analyze(), EcalURecHitHists(), and endJob().
std::vector<std::string> EcalURecHitHists::maskedEBs_ [private] |
std::vector<int> EcalURecHitHists::maskedFEDs_ [private] |
int EcalURecHitHists::runNum_ [private] |