Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023 #include <vector>
00024
00025
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "HLTrigger/HLTcore/interface/HLTFilter.h"
00028
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/MakerMacros.h"
00031 #include "FWCore/Framework/interface/ESHandle.h"
00032
00033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00034
00035 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00036 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
00037 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00038
00039 #include "DataFormats/DetId/interface/DetId.h"
00040 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00041 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00042
00043 #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
00044 #include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h"
00045 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h"
00046 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h"
00047
00048 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
00049 #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
00050
00051
00052
00053
00054
00055 class EcalMIPRecHitFilter : public HLTFilter {
00056 public:
00057 explicit EcalMIPRecHitFilter(const edm::ParameterSet&);
00058 ~EcalMIPRecHitFilter();
00059
00060 private:
00061 virtual void beginJob() ;
00062 virtual bool filter(edm::Event&, const edm::EventSetup&);
00063 virtual void endJob() ;
00064
00065
00066
00067 edm::InputTag EcalRecHitCollection_;
00068 double minAmp1_;
00069 double minAmp2_;
00070 double minSingleAmp_;
00071 std::vector<int> maskedList_;
00072 int side_;
00073
00074 };
00075
00076
00077
00078
00079 EcalMIPRecHitFilter::EcalMIPRecHitFilter(const edm::ParameterSet& iConfig)
00080 {
00081
00082 minSingleAmp_ = iConfig.getUntrackedParameter<double>("SingleAmpMin", 0.108);
00083 minAmp1_ = iConfig.getUntrackedParameter<double>("AmpMinSeed", 0.063);
00084 minAmp2_ = iConfig.getUntrackedParameter<double>("AmpMin2", 0.045);
00085 maskedList_ = iConfig.getUntrackedParameter<std::vector<int> >("maskedChannels", maskedList_);
00086 EcalRecHitCollection_ = iConfig.getParameter<edm::InputTag>("EcalRecHitCollection");
00087 side_ = iConfig.getUntrackedParameter<int>("side", 3);
00088 }
00089
00090
00091 EcalMIPRecHitFilter::~EcalMIPRecHitFilter()
00092 {
00093
00094
00095
00096
00097 }
00098
00099
00100
00101
00102
00103
00104
00105 bool
00106 EcalMIPRecHitFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup)
00107 {
00108 using namespace edm;
00109
00110
00111 Handle<EcalRecHitCollection> recHits;
00112
00113
00114
00115
00116
00117 iEvent.getByLabel(EcalRecHitCollection_, recHits);
00118 if (!recHits.isValid()){
00119 LogWarning("EcalMIPRecHitFilter") << EcalRecHitCollection_ << " not available";
00120 }
00121
00122 ESHandle<CaloTopology> caloTopo;
00123 iSetup.get<CaloTopologyRecord>().get(caloTopo);
00124
00125
00126 edm::ESHandle<EcalIntercalibConstants> pIcal;
00127 iSetup.get<EcalIntercalibConstantsRcd>().get(pIcal);
00128 const EcalIntercalibConstants* ical = pIcal.product();
00129 const EcalIntercalibConstantMap& icalMap=ical->getMap();
00130
00131 edm::ESHandle<EcalLaserDbService> pLaser;
00132 iSetup.get<EcalLaserDbRecord>().get( pLaser );
00133
00134 edm::ESHandle<EcalADCToGeVConstant> pAgc;
00135 iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
00136 const EcalADCToGeVConstant* agc = pAgc.product();
00137
00138 float adcconst = agc->getEBValue();
00139
00140 bool thereIsSignal = false;
00141
00142 for ( EcalRecHitCollection::const_iterator hitItr = recHits->begin(); hitItr != recHits->end(); ++hitItr ) {
00143
00144 EcalRecHit hit = (*hitItr);
00145
00146
00147 std::vector<int>::iterator result;
00148 result = find( maskedList_.begin(), maskedList_.end(), EBDetId(hit.id()).hashedIndex() );
00149 if (result != maskedList_.end())
00150
00151 continue;
00152
00153 float ampli_ = hit.energy();
00154 EBDetId ebDet = hit.id();
00155
00156
00157 EcalIntercalibConstantMap::const_iterator icalit=icalMap.find(ebDet);
00158 EcalIntercalibConstant icalconst = 1.;
00159 if( icalit!=icalMap.end() ){
00160 icalconst = (*icalit);
00161
00162 } else {
00163
00164 }
00165 float lasercalib = pLaser->getLaserCorrection( EBDetId(ebDet), iEvent.time() );
00166
00167 ampli_ /= (icalconst * lasercalib * adcconst);
00168
00169 if (ampli_ >= minSingleAmp_ )
00170 {
00171
00172 thereIsSignal = true;
00173
00174
00175
00176
00177 break;
00178 }
00179
00180
00181 if (ampli_ >= minAmp1_)
00182 {
00183
00184 std::vector<DetId> neighbors = caloTopo->getWindow(ebDet,side_,side_);
00185 float secondMin = 0.;
00186 for(std::vector<DetId>::const_iterator detitr = neighbors.begin(); detitr != neighbors.end(); ++detitr)
00187 {
00188 EcalRecHitCollection::const_iterator thishit = recHits->find((*detitr));
00189 if (thishit == recHits->end())
00190 {
00191
00192 continue;
00193 }
00194 if ((*thishit).id() != ebDet)
00195 {
00196 float thisamp = (*thishit).energy();
00197
00198 EcalIntercalibConstantMap::const_iterator icalit2=icalMap.find((*thishit).id());
00199 EcalIntercalibConstant icalconst2 = 1.;
00200 if( icalit2!=icalMap.end() ){
00201 icalconst2 = (*icalit2);
00202
00203 } else {
00204
00205 }
00206 float lasercalib2 = pLaser->getLaserCorrection( EBDetId((*thishit).id()), iEvent.time() );
00207 thisamp /= (icalconst2 * lasercalib2 * adcconst);
00208 if (thisamp > secondMin) secondMin = thisamp;
00209 }
00210 }
00211
00212 if (secondMin > minAmp2_ )
00213 {
00214 thereIsSignal = true;
00215 break;
00216 }
00217 }
00218 }
00219
00220 return thereIsSignal;
00221 }
00222
00223
00224 void
00225 EcalMIPRecHitFilter::beginJob()
00226 {
00227 }
00228
00229
00230 void
00231 EcalMIPRecHitFilter::endJob() {
00232 }
00233
00234
00235 DEFINE_FWK_MODULE(EcalMIPRecHitFilter);