#include <Validation/SiStripAnalyzer/src/SiStripBaselineAnalyzer.cc>
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 75 of file SiStripBaselineAnalyzer.cc.
SiStripBaselineAnalyzer::SiStripBaselineAnalyzer | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 124 of file SiStripBaselineAnalyzer.cc.
References SiStripRawProcessingFactory::create_SubtractorPed(), fs_, edm::ParameterSet::getParameter(), h1APVCM_, h1BadAPVperEvent_, h1Pedestals_, nModuletoDisplay_, plotAPVCM_, plotBaseline_, plotBaselinePoints_, plotClusters_, plotPedestals_, plotRawDigi_, srcAPVCM_, srcBaseline_, srcBaselinePoints_, srcProcessedRawDigi_, and subtractorPed_.
{ srcBaseline_ = conf.getParameter<edm::InputTag>( "srcBaseline" ); srcBaselinePoints_ = conf.getParameter<edm::InputTag>( "srcBaselinePoints" ); srcProcessedRawDigi_ = conf.getParameter<edm::InputTag>( "srcProcessedRawDigi" ); srcAPVCM_ = conf.getParameter<edm::InputTag>( "srcAPVCM" ); subtractorPed_ = SiStripRawProcessingFactory::create_SubtractorPed(conf.getParameter<edm::ParameterSet>("Algorithms")); nModuletoDisplay_ = conf.getParameter<uint32_t>( "nModuletoDisplay" ); plotClusters_ = conf.getParameter<bool>( "plotClusters" ); plotBaseline_ = conf.getParameter<bool>( "plotBaseline" ); plotBaselinePoints_ = conf.getParameter<bool>( "plotBaselinePoints" ); plotRawDigi_ = conf.getParameter<bool>( "plotRawDigi" ); plotAPVCM_ = conf.getParameter<bool>( "plotAPVCM" ); plotPedestals_ = conf.getParameter<bool>( "plotPedestals" ); h1BadAPVperEvent_ = fs_->make<TH1F>("BadAPV/Event","BadAPV/Event", 2001, -0.5, 2000.5); h1BadAPVperEvent_->SetXTitle("# Modules with Bad APVs"); h1BadAPVperEvent_->SetYTitle("Entries"); h1BadAPVperEvent_->SetLineWidth(2); h1BadAPVperEvent_->SetLineStyle(2); h1APVCM_ = fs_->make<TH1F>("APV CM","APV CM", 2048, -1023.5, 1023.5); h1APVCM_->SetXTitle("APV CM [adc]"); h1APVCM_->SetYTitle("Entries"); h1APVCM_->SetLineWidth(2); h1APVCM_->SetLineStyle(2); h1Pedestals_ = fs_->make<TH1F>("Pedestals","Pedestals", 2048, -1023.5, 1023.5); h1Pedestals_->SetXTitle("Pedestals [adc]"); h1Pedestals_->SetYTitle("Entries"); h1Pedestals_->SetLineWidth(2); h1Pedestals_->SetLineStyle(2); }
SiStripBaselineAnalyzer::~SiStripBaselineAnalyzer | ( | ) |
Definition at line 162 of file SiStripBaselineAnalyzer.cc.
{ }
void SiStripBaselineAnalyzer::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | es | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 170 of file SiStripBaselineAnalyzer.cc.
References actualModule_, ecalMGPA::adc(), sistrip::APV, edmNew::DetSetVector< T >::begin(), edm::DetSetVector< T >::begin(), edm::DetSet< T >::begin(), combineCards::bins, gather_cfg::cout, edmNew::DetSetVector< T >::end(), edm::DetSet< T >::end(), edm::DetSetVector< T >::end(), edm::EventID::event(), event(), fs_, edm::EventSetup::get(), edm::Event::getByLabel(), h1APVCM_, h1BadAPVperEvent_, h1Baseline_, h1Clusters_, h1Pedestals_, h1ProcessedRawDigis_, i, edmNew::DetSetVector< T >::id(), edm::EventBase::id(), nModuletoDisplay_, pedestals, pedestalsHandle, peds_cache_id, plotAPVCM_, plotBaseline_, plotBaselinePoints_, plotClusters_, plotPedestals_, plotRawDigi_, edm::EventID::run(), DTTTrigCorrFirst::run, gather_cfg::runs, srcAPVCM_, srcBaseline_, srcProcessedRawDigi_, strip(), and subtractorPed_.
{ using namespace edm; if(plotPedestals_&&actualModule_ ==0){ uint32_t p_cache_id = es.get<SiStripPedestalsRcd>().cacheIdentifier(); if(p_cache_id != peds_cache_id) { es.get<SiStripPedestalsRcd>().get(pedestalsHandle); peds_cache_id = p_cache_id; } std::vector<uint32_t> detIdV; pedestalsHandle->getDetIds(detIdV); for(uint32_t i=0; i < detIdV.size(); ++i){ pedestals.clear(); SiStripPedestals::Range pedestalsRange = pedestalsHandle->getRange(detIdV[i]); pedestals.resize((pedestalsRange.second- pedestalsRange.first)*8/10); pedestalsHandle->allPeds(pedestals, pedestalsRange); for(uint32_t it=0; it < pedestals.size(); ++it) h1Pedestals_->Fill(pedestals[it]); } } if(plotAPVCM_){ edm::Handle<edm::DetSetVector<SiStripProcessedRawDigi> > moduleCM; edm::InputTag CMLabel("siStripZeroSuppression:APVCM"); e.getByLabel(srcAPVCM_,moduleCM); edm::DetSetVector<SiStripProcessedRawDigi>::const_iterator itCMDetSetV =moduleCM->begin(); for (; itCMDetSetV != moduleCM->end(); ++itCMDetSetV){ edm::DetSet<SiStripProcessedRawDigi>::const_iterator itCM= itCMDetSetV->begin(); for(;itCM != itCMDetSetV->end(); ++itCM) h1APVCM_->Fill(itCM->adc()); } } if(!plotRawDigi_) return; subtractorPed_->init(es); edm::Handle< edm::DetSetVector<SiStripRawDigi> > moduleRawDigi; e.getByLabel(srcProcessedRawDigi_,moduleRawDigi); edm::Handle<edm::DetSetVector<SiStripProcessedRawDigi> > moduleBaseline; if(plotBaseline_) e.getByLabel(srcBaseline_, moduleBaseline); edm::Handle<edm::DetSetVector<SiStripDigi> > moduleBaselinePoints; if(plotBaselinePoints_) e.getByLabel(srcBaseline_, moduleBaselinePoints); edm::Handle<edmNew::DetSetVector<SiStripCluster> > clusters; if(plotClusters_){ edm::InputTag clusLabel("siStripClusters"); e.getByLabel(clusLabel, clusters); } char detIds[20]; char evs[20]; char runs[20]; TFileDirectory sdProcessedRawDigis_= fs_->mkdir("ProcessedRawDigis"); TFileDirectory sdBaseline_= fs_->mkdir("Baseline"); TFileDirectory sdBaselinePoints_= fs_->mkdir("BaselinePoints"); TFileDirectory sdClusters_= fs_->mkdir("Clusters"); edm::DetSetVector<SiStripProcessedRawDigi>::const_iterator itDSBaseline; if(plotBaseline_) itDSBaseline = moduleBaseline->begin(); edm::DetSetVector<SiStripRawDigi>::const_iterator itRawDigis = moduleRawDigi->begin(); uint32_t NBabAPVs = moduleRawDigi->size(); std::cout<< "Number of module with HIP in this event: " << NBabAPVs << std::endl; h1BadAPVperEvent_->Fill(NBabAPVs); for (; itRawDigis != moduleRawDigi->end(); ++itRawDigis) { if(actualModule_ > nModuletoDisplay_) return; uint32_t detId = itRawDigis->id; if(plotBaseline_){ //std::cout << "bas id: " << itDSBaseline->id << " raw id: " << detId << std::endl; if(itDSBaseline->id != detId){ std::cout << "Collections out of Synch. Something of fishy is going on ;-)" << std::endl; return; } } actualModule_++; uint32_t event = e.id().event(); uint32_t run = e.id().run(); //std::cout << "processing module N: " << actualModule_<< " detId: " << detId << " event: "<< event << std::endl; edm::DetSet<SiStripRawDigi>::const_iterator itRaw = itRawDigis->begin(); bool restAPV[6] = {0,0,0,0,0,0}; int strip =0, totADC=0; int minAPVRes = 7, maxAPVRes = -1; for(;itRaw != itRawDigis->end(); ++itRaw, ++strip){ float adc = itRaw->adc(); totADC+= adc; if(strip%127 ==0){ //std::cout << "totADC " << totADC << std::endl; int APV = strip/128; if(totADC!= 0){ restAPV[APV] = true; totADC =0; if(APV>maxAPVRes) maxAPVRes = APV; if(APV<minAPVRes) minAPVRes = APV; } } } uint16_t bins =768; float minx = -0.5, maxx=767.5; if(minAPVRes !=7){ minx = minAPVRes * 128 -0.5; maxx = maxAPVRes * 128 + 127.5; bins = maxx-minx; } sprintf(detIds,"%ul", detId); sprintf(evs,"%ul", event); sprintf(runs,"%ul", run); char* dHistoName = Form("Id:%s_run:%s_ev:%s",detIds, runs, evs); h1ProcessedRawDigis_ = sdProcessedRawDigis_.make<TH1F>(dHistoName,dHistoName, bins, minx, maxx); if(plotBaseline_){ h1Baseline_ = sdBaseline_.make<TH1F>(dHistoName,dHistoName, bins, minx, maxx); h1Baseline_->SetXTitle("strip#"); h1Baseline_->SetYTitle("ADC"); h1Baseline_->SetMaximum(1024.); h1Baseline_->SetMinimum(-300.); h1Baseline_->SetLineWidth(2); h1Baseline_->SetLineStyle(2); h1Baseline_->SetLineColor(2); } if(plotClusters_){ h1Clusters_ = sdClusters_.make<TH1F>(dHistoName,dHistoName, bins, minx, maxx); h1Clusters_->SetXTitle("strip#"); h1Clusters_->SetYTitle("ADC"); h1Clusters_->SetMaximum(1024.); h1Clusters_->SetMinimum(-300.); h1Clusters_->SetLineWidth(2); h1Clusters_->SetLineStyle(2); h1Clusters_->SetLineColor(3); } h1ProcessedRawDigis_->SetXTitle("strip#"); h1ProcessedRawDigis_->SetYTitle("ADC"); h1ProcessedRawDigis_->SetMaximum(1024.); h1ProcessedRawDigis_->SetMinimum(-300.); h1ProcessedRawDigis_->SetLineWidth(2); std::vector<int16_t> ProcessedRawDigis(itRawDigis->size()); subtractorPed_->subtract( *itRawDigis, ProcessedRawDigis); edm::DetSet<SiStripProcessedRawDigi>::const_iterator itBaseline; if(plotBaseline_) itBaseline = itDSBaseline->begin(); std::vector<int16_t>::const_iterator itProcessedRawDigis; strip =0; for(itProcessedRawDigis = ProcessedRawDigis.begin();itProcessedRawDigis != ProcessedRawDigis.end(); ++itProcessedRawDigis){ if(restAPV[strip/128]){ float adc = *itProcessedRawDigis; h1ProcessedRawDigis_->Fill(strip, adc); if(plotBaseline_){ h1Baseline_->Fill(strip, itBaseline->adc()); ++itBaseline; } } ++strip; } if(plotBaseline_) ++itDSBaseline; if(plotClusters_){ edmNew::DetSetVector<SiStripCluster>::const_iterator itClusters = clusters->begin(); for ( ; itClusters != clusters->end(); ++itClusters ){ for ( edmNew::DetSet<SiStripCluster>::const_iterator clus = itClusters->begin(); clus != itClusters->end(); ++clus){ if(itClusters->id() == detId){ int firststrip = clus->firstStrip(); //std::cout << "Found cluster in detId " << detId << " " << firststrip << " " << clus->amplitudes().size() << " -----------------------------------------------" << std::endl; strip=0; for( std::vector<uint8_t>::const_iterator itAmpl = clus->amplitudes().begin(); itAmpl != clus->amplitudes().end(); ++itAmpl){ h1Clusters_->Fill(firststrip+strip, *itAmpl); ++strip; } } } } } } }
void SiStripBaselineAnalyzer::beginJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 369 of file SiStripBaselineAnalyzer.cc.
References actualModule_.
{ actualModule_ =0; }
void SiStripBaselineAnalyzer::endJob | ( | void | ) | [private, virtual] |
uint16_t SiStripBaselineAnalyzer::actualModule_ [private] |
Definition at line 120 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and beginJob().
TCanvas* SiStripBaselineAnalyzer::Canvas_ [private] |
Definition at line 113 of file SiStripBaselineAnalyzer.cc.
edm::Service<TFileService> SiStripBaselineAnalyzer::fs_ [private] |
Definition at line 103 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
TH1F* SiStripBaselineAnalyzer::h1APVCM_ [private] |
Definition at line 110 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
TH1F* SiStripBaselineAnalyzer::h1BadAPVperEvent_ [private] |
Definition at line 105 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
TH1F* SiStripBaselineAnalyzer::h1Baseline_ [private] |
Definition at line 108 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze().
TH1F* SiStripBaselineAnalyzer::h1Clusters_ [private] |
Definition at line 109 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze().
TH1F* SiStripBaselineAnalyzer::h1Pedestals_ [private] |
Definition at line 111 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
TH1F* SiStripBaselineAnalyzer::h1ProcessedRawDigis_ [private] |
Definition at line 107 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze().
uint16_t SiStripBaselineAnalyzer::nModuletoDisplay_ [private] |
Definition at line 119 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
std::vector<int> SiStripBaselineAnalyzer::pedestals [private] |
Definition at line 88 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze().
Definition at line 87 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze().
uint32_t SiStripBaselineAnalyzer::peds_cache_id [private] |
Definition at line 89 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze().
bool SiStripBaselineAnalyzer::plotAPVCM_ [private] |
Definition at line 95 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
bool SiStripBaselineAnalyzer::plotBaseline_ [private] |
Definition at line 92 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
bool SiStripBaselineAnalyzer::plotBaselinePoints_ [private] |
Definition at line 93 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
bool SiStripBaselineAnalyzer::plotClusters_ [private] |
Definition at line 91 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
bool SiStripBaselineAnalyzer::plotPedestals_ [private] |
Definition at line 96 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
bool SiStripBaselineAnalyzer::plotRawDigi_ [private] |
Definition at line 94 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
Definition at line 100 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
Definition at line 98 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
Definition at line 99 of file SiStripBaselineAnalyzer.cc.
Referenced by SiStripBaselineAnalyzer().
Definition at line 101 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
std::auto_ptr<SiStripPedestalsSubtractor> SiStripBaselineAnalyzer::subtractorPed_ [private] |
Definition at line 86 of file SiStripBaselineAnalyzer.cc.
Referenced by analyze(), and SiStripBaselineAnalyzer().
std::vector<TH1F> SiStripBaselineAnalyzer::vBaselineHisto_ [private] |
Definition at line 115 of file SiStripBaselineAnalyzer.cc.
std::vector<TH1F> SiStripBaselineAnalyzer::vBaselinePointsHisto_ [private] |
Definition at line 116 of file SiStripBaselineAnalyzer.cc.
std::vector<TH1F> SiStripBaselineAnalyzer::vClusterHisto_ [private] |
Definition at line 117 of file SiStripBaselineAnalyzer.cc.
std::vector<TH1F> SiStripBaselineAnalyzer::vProcessedRawDigiHisto_ [private] |
Definition at line 114 of file SiStripBaselineAnalyzer.cc.