#include <DQM/EcalBarrelMonitorTasks/interface/EBCosmicTask.h>
Public Member Functions | |
EBCosmicTask (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~EBCosmicTask () |
Destructor. | |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
Analyze. | |
void | beginJob (const edm::EventSetup &c) |
BeginJob. | |
void | beginRun (const edm::Run &r, const edm::EventSetup &c) |
BeginRun. | |
void | cleanup (void) |
Cleanup. | |
void | endJob (void) |
EndJob. | |
void | endRun (const edm::Run &r, const edm::EventSetup &c) |
EndRun. | |
void | reset (void) |
Reset. | |
void | setup (void) |
Setup. | |
Private Attributes | |
DQMStore * | dqmStore_ |
edm::InputTag | EcalRawDataCollection_ |
edm::InputTag | EcalRecHitCollection_ |
edm::InputTag | EcalUncalibratedRecHitCollection_ |
bool | enableCleanup_ |
double | highThreshold_ |
int | ievt_ |
bool | init_ |
double | lowThreshold_ |
double | maxJitter_ |
MonitorElement * | meCutMap_ [36] |
bool | mergeRuns_ |
MonitorElement * | meSelMap_ [36] |
MonitorElement * | meSpectrum_ [2][36] |
double | minJitter_ |
std::string | prefixME_ |
Definition at line 20 of file EBCosmicTask.h.
EBCosmicTask::EBCosmicTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 34 of file EBCosmicTask.cc.
References dqmStore_, EcalRawDataCollection_, EcalRecHitCollection_, EcalUncalibratedRecHitCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), highThreshold_, i, init_, lowThreshold_, maxJitter_, meCutMap_, mergeRuns_, meSelMap_, meSpectrum_, minJitter_, and prefixME_.
00034 { 00035 00036 init_ = false; 00037 00038 dqmStore_ = Service<DQMStore>().operator->(); 00039 00040 prefixME_ = ps.getUntrackedParameter<string>("prefixME", ""); 00041 00042 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false); 00043 00044 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false); 00045 00046 EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection"); 00047 EcalUncalibratedRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalUncalibratedRecHitCollection"); 00048 EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection"); 00049 00050 lowThreshold_ = 0.06125; // 7 ADC counts at G200 00051 highThreshold_ = 0.12500; // typical muon energy deposit is 250 MeV 00052 00053 minJitter_ = -2.0; 00054 maxJitter_ = 1.5; 00055 00056 for (int i = 0; i < 36; i++) { 00057 meCutMap_[i] = 0; 00058 meSelMap_[i] = 0; 00059 meSpectrum_[0][i] = 0; 00060 meSpectrum_[1][i] = 0; 00061 } 00062 00063 }
EBCosmicTask::~EBCosmicTask | ( | ) | [virtual] |
void EBCosmicTask::analyze | ( | const edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 183 of file EBCosmicTask.cc.
References EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, EcalBarrel, EcalRawDataCollection_, EcalRecHitCollection_, EcalUncalibratedRecHitCollection_, EBDetId::ETAPHIMODE, MonitorElement::Fill(), edm::Event::getByLabel(), highThreshold_, ievt_, init_, Numbers::iSM(), edm::Handle< T >::isValid(), LogDebug, lowThreshold_, maxJitter_, meCutMap_, meSelMap_, meSpectrum_, minJitter_, EcalDCCHeaderBlock::MTCC, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, row, setup(), Numbers::subDet(), and EBDetId::validDetId().
00183 { 00184 00185 bool isData = true; 00186 bool enable = false; 00187 int runType[36] = { -1 }; 00188 00189 Handle<EcalRawDataCollection> dcchs; 00190 00191 if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) { 00192 00193 for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) { 00194 00195 if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue; 00196 00197 int ism = Numbers::iSM( *dcchItr, EcalBarrel ); 00198 00199 runType[ism-1] = dcchItr->getRunType(); 00200 00201 if ( dcchItr->getRunType() == EcalDCCHeaderBlock::COSMIC || 00202 dcchItr->getRunType() == EcalDCCHeaderBlock::MTCC || 00203 dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_GLOBAL || 00204 dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_GLOBAL || 00205 dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_LOCAL || 00206 dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_LOCAL ) enable = true; 00207 00208 } 00209 00210 } else { 00211 00212 isData = false; enable = true; 00213 LogWarning("EBCosmicTask") << EcalRawDataCollection_ << " not available"; 00214 00215 } 00216 00217 if ( ! enable ) return; 00218 00219 if ( ! init_ ) this->setup(); 00220 00221 ievt_++; 00222 00223 Handle<EcalRecHitCollection> hits; 00224 00225 if ( e.getByLabel(EcalRecHitCollection_, hits) ) { 00226 00227 int nebh = hits->size(); 00228 LogDebug("EBCosmicTask") << "event " << ievt_ << " hits collection size " << nebh; 00229 00230 Handle<EcalUncalibratedRecHitCollection> uhits; 00231 00232 if ( ! e.getByLabel(EcalUncalibratedRecHitCollection_, uhits) ) { 00233 LogWarning("EBCosmicTask") << EcalUncalibratedRecHitCollection_ << " not available"; 00234 } 00235 00236 for ( EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) { 00237 00238 EBDetId id = hitItr->id(); 00239 00240 int ic = id.ic(); 00241 int ie = (ic-1)/20 + 1; 00242 int ip = (ic-1)%20 + 1; 00243 00244 int ism = Numbers::iSM( id ); 00245 00246 float xie = ie - 0.5; 00247 float xip = ip - 0.5; 00248 00249 if ( isData ) { 00250 00251 if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::COSMIC || 00252 runType[ism-1] == EcalDCCHeaderBlock::MTCC || 00253 runType[ism-1] == EcalDCCHeaderBlock::COSMICS_GLOBAL || 00254 runType[ism-1] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || 00255 runType[ism-1] == EcalDCCHeaderBlock::COSMICS_LOCAL || 00256 runType[ism-1] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) ) continue; 00257 00258 } 00259 00260 LogDebug("EBCosmicTask") << " det id = " << id; 00261 LogDebug("EBCosmicTask") << " sm, ieta, iphi " << ism << " " << ie << " " << ip; 00262 00263 float xval = hitItr->energy(); 00264 if ( xval <= 0. ) xval = 0.0; 00265 00266 LogDebug("EBCosmicTask") << " hit energy " << xval; 00267 00268 // look for the seeds 00269 float e3x3 = 0.; 00270 bool isSeed = true; 00271 00272 // evaluate 3x3 matrix around a seed 00273 for(int icry=0; icry<9; ++icry) { 00274 unsigned int row = icry/3; 00275 unsigned int column = icry%3; 00276 int icryEta = id.ieta()+column-1; 00277 int icryPhi = id.iphi()+row-1; 00278 if ( EBDetId::validDetId(icryEta, icryPhi) ) { 00279 EBDetId id3x3 = EBDetId(icryEta, icryPhi, EBDetId::ETAPHIMODE); 00280 if ( hits->find(id3x3) != hits->end() ) { 00281 float neighbourEnergy = hits->find(id3x3)->energy(); 00282 e3x3 += neighbourEnergy; 00283 if ( neighbourEnergy > xval ) isSeed = false; 00284 } 00285 } 00286 } 00287 00288 // find the jitter of the seed 00289 float jitter = -999.; 00290 if ( isSeed ) { 00291 if ( uhits.isValid() ) { 00292 if ( uhits->find(id) != uhits->end() ) { 00293 jitter = uhits->find(id)->jitter(); 00294 } 00295 } 00296 } 00297 00298 if ( xval >= lowThreshold_ ) { 00299 if ( meCutMap_[ism-1] ) meCutMap_[ism-1]->Fill(xie, xip, xval); 00300 } 00301 00302 if ( isSeed && e3x3 >= highThreshold_ && jitter > minJitter_ && jitter < maxJitter_ ) { 00303 if ( meSelMap_[ism-1] ) meSelMap_[ism-1]->Fill(xie, xip, e3x3); 00304 } 00305 00306 if ( meSpectrum_[0][ism-1] ) meSpectrum_[0][ism-1]->Fill(xval); 00307 00308 if ( isSeed && xval >= lowThreshold_ && jitter > minJitter_ && jitter < maxJitter_ ) { 00309 if ( meSpectrum_[1][ism-1] ) meSpectrum_[1][ism-1]->Fill(e3x3); 00310 } 00311 00312 } 00313 00314 } else { 00315 00316 LogWarning("EBCosmicTask") << EcalRecHitCollection_ << " not available"; 00317 00318 } 00319 00320 }
void EBCosmicTask::beginJob | ( | const edm::EventSetup & | c | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 69 of file EBCosmicTask.cc.
References dqmStore_, ievt_, Numbers::initGeometry(), prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().
00069 { 00070 00071 ievt_ = 0; 00072 00073 if ( dqmStore_ ) { 00074 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask"); 00075 dqmStore_->rmdir(prefixME_ + "/EBCosmicTask"); 00076 } 00077 00078 Numbers::initGeometry(c, false); 00079 00080 }
void EBCosmicTask::beginRun | ( | const edm::Run & | r, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 82 of file EBCosmicTask.cc.
References mergeRuns_, and reset().
00082 { 00083 00084 if ( ! mergeRuns_ ) this->reset(); 00085 00086 }
Cleanup.
Definition at line 142 of file EBCosmicTask.cc.
References dqmStore_, edm::getName(), i, init_, meCutMap_, meSelMap_, meSpectrum_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().
Referenced by endJob().
00142 { 00143 00144 if ( ! init_ ) return; 00145 00146 if ( dqmStore_ ) { 00147 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask"); 00148 00149 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask/Cut"); 00150 for (int i = 0; i < 36; i++) { 00151 if ( meCutMap_[i] ) dqmStore_->removeElement( meCutMap_[i]->getName() ); 00152 meCutMap_[i] = 0; 00153 } 00154 00155 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask/Sel"); 00156 for (int i = 0; i < 36; i++) { 00157 if ( meSelMap_[i] ) dqmStore_->removeElement( meSelMap_[i]->getName() ); 00158 meSelMap_[i] = 0; 00159 } 00160 00161 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask/Spectrum"); 00162 for (int i = 0; i < 36; i++) { 00163 if ( meSpectrum_[0][i] ) dqmStore_->removeElement( meSpectrum_[0][i]->getName() ); 00164 meSpectrum_[0][i] = 0; 00165 if ( meSpectrum_[1][i] ) dqmStore_->removeElement( meSpectrum_[1][i]->getName() ); 00166 meSpectrum_[1][i] = 0; 00167 } 00168 00169 } 00170 00171 init_ = false; 00172 00173 }
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 175 of file EBCosmicTask.cc.
References cleanup(), enableCleanup_, and ievt_.
00175 { 00176 00177 LogInfo("EBCosmicTask") << "analyzed " << ievt_ << " events"; 00178 00179 if ( enableCleanup_ ) this->cleanup(); 00180 00181 }
void EBCosmicTask::endRun | ( | const edm::Run & | r, | |
const edm::EventSetup & | c | |||
) | [protected, virtual] |
Reset.
Definition at line 92 of file EBCosmicTask.cc.
References i, meCutMap_, meSelMap_, meSpectrum_, and MonitorElement::Reset().
Referenced by beginRun().
00092 { 00093 00094 for (int i = 0; i < 36; i++) { 00095 if ( meCutMap_[i] ) meCutMap_[i]->Reset(); 00096 if ( meSelMap_[i] ) meSelMap_[i]->Reset(); 00097 if ( meSpectrum_[0][i] ) meSpectrum_[0][i]->Reset(); 00098 if ( meSpectrum_[1][i] ) meSpectrum_[1][i]->Reset(); 00099 } 00100 00101 }
Setup.
Definition at line 103 of file EBCosmicTask.cc.
References DQMStore::book1D(), DQMStore::bookProfile2D(), dqmStore_, histo, i, init_, meCutMap_, meSelMap_, meSpectrum_, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().
Referenced by analyze().
00103 { 00104 00105 init_ = true; 00106 00107 char histo[200]; 00108 00109 if ( dqmStore_ ) { 00110 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask"); 00111 00112 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask/Cut"); 00113 for (int i = 0; i < 36; i++) { 00114 sprintf(histo, "EBCT energy cut %s", Numbers::sEB(i+1).c_str()); 00115 meCutMap_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s"); 00116 meCutMap_[i]->setAxisTitle("ieta", 1); 00117 meCutMap_[i]->setAxisTitle("iphi", 2); 00118 } 00119 00120 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask/Sel"); 00121 for (int i = 0; i < 36; i++) { 00122 sprintf(histo, "EBCT energy sel %s", Numbers::sEB(i+1).c_str()); 00123 meSelMap_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s"); 00124 meSelMap_[i]->setAxisTitle("ieta", 1); 00125 meSelMap_[i]->setAxisTitle("iphi", 2); 00126 } 00127 00128 dqmStore_->setCurrentFolder(prefixME_ + "/EBCosmicTask/Spectrum"); 00129 for (int i = 0; i < 36; i++) { 00130 sprintf(histo, "EBCT 1x1 energy spectrum %s", Numbers::sEB(i+1).c_str()); 00131 meSpectrum_[0][i] = dqmStore_->book1D(histo, histo, 100, 0., 1.5); 00132 meSpectrum_[0][i]->setAxisTitle("energy (GeV)", 1); 00133 sprintf(histo, "EBCT 3x3 energy spectrum %s", Numbers::sEB(i+1).c_str()); 00134 meSpectrum_[1][i] = dqmStore_->book1D(histo, histo, 100, 0., 1.5); 00135 meSpectrum_[1][i]->setAxisTitle("energy (GeV)", 1); 00136 } 00137 00138 } 00139 00140 }
DQMStore* EBCosmicTask::dqmStore_ [private] |
Definition at line 60 of file EBCosmicTask.h.
Referenced by beginJob(), cleanup(), EBCosmicTask(), and setup().
bool EBCosmicTask::enableCleanup_ [private] |
double EBCosmicTask::highThreshold_ [private] |
int EBCosmicTask::ievt_ [private] |
bool EBCosmicTask::init_ [private] |
Definition at line 83 of file EBCosmicTask.h.
Referenced by analyze(), cleanup(), EBCosmicTask(), and setup().
double EBCosmicTask::lowThreshold_ [private] |
double EBCosmicTask::maxJitter_ [private] |
MonitorElement* EBCosmicTask::meCutMap_[36] [private] |
Definition at line 72 of file EBCosmicTask.h.
Referenced by analyze(), cleanup(), EBCosmicTask(), reset(), and setup().
bool EBCosmicTask::mergeRuns_ [private] |
MonitorElement* EBCosmicTask::meSelMap_[36] [private] |
Definition at line 74 of file EBCosmicTask.h.
Referenced by analyze(), cleanup(), EBCosmicTask(), reset(), and setup().
MonitorElement* EBCosmicTask::meSpectrum_[2][36] [private] |
Definition at line 76 of file EBCosmicTask.h.
Referenced by analyze(), cleanup(), EBCosmicTask(), reset(), and setup().
double EBCosmicTask::minJitter_ [private] |
std::string EBCosmicTask::prefixME_ [private] |
Definition at line 62 of file EBCosmicTask.h.
Referenced by beginJob(), cleanup(), EBCosmicTask(), and setup().