Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "EventFilter/SiStripChannelChargeFilter/interface/TECClusterFilter.h"
00011 #include "DataFormats/Common/interface/Handle.h"
00012 #include "DataFormats/Common/interface/DetSetVector.h"
00013 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00014
00015
00016
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018
00019 using namespace std;
00020
00021 namespace cms
00022 {
00023
00024 TECClusterFilter::TECClusterFilter(const edm::ParameterSet& ps){
00025
00026 ModulesToBeExcluded.clear();
00027 ModulesToBeExcluded = ps.getParameter< std::vector<unsigned> >("ModulesToBeExcluded");
00028 edm::LogInfo("TECClusterFilter")<<"Clusters from "<<ModulesToBeExcluded.size()<<" modules will be ignored in the filter:";
00029 for( std::vector<uint32_t>::const_iterator imod = ModulesToBeExcluded.begin(); imod != ModulesToBeExcluded.end(); imod++){
00030 edm::LogInfo("TECClusterFilter")<< *imod;
00031 }
00032
00033 ChargeThresholdTEC=ps.getParameter<int>("ChargeThresholdTEC");
00034 edm::LogInfo("TECClusterFilter")<<"ChargeThresholdTEC"<<ChargeThresholdTEC;
00035 minNrOfTECClusters=ps.getParameter<int>("MinNrOfTECClusters");
00036 edm::LogInfo("TECClusterFilter")<<"MinNrOfTECClusters"<<minNrOfTECClusters;
00037 clusterProducer = ps.getParameter<string>("ClusterProducer");
00038 edm::LogInfo("TECClusterFilter")<<"ClusterProducer"<<clusterProducer;
00039
00040
00041 produces <int>();
00042 }
00043
00044 bool TECClusterFilter::filter(edm::Event & e, edm::EventSetup const& c)
00045 {
00046 edm::Handle< edm::DetSetVector<SiStripCluster> > h;
00047 e.getByLabel(clusterProducer,h);
00048 bool decision=false;
00049 unsigned int nr_clusters_above_threshold = 0;
00050 for (edm::DetSetVector<SiStripCluster>::const_iterator it=h->begin();it!=h->end();it++)
00051 {
00052 DetId thedetId = DetId(it->detId());
00053 bool exclude_this_detid = false;
00054 for(vector<SiStripCluster>::const_iterator vit=(it->data).begin(); vit!=(it->data).end(); vit++)
00055 {
00056 for( std::vector<uint32_t>::const_iterator imod = ModulesToBeExcluded.begin(); imod != ModulesToBeExcluded.end(); imod++ )
00057 { if(*imod == thedetId.rawId()) exclude_this_detid = true; }
00058 if( (! exclude_this_detid ) && (thedetId.subdetId()==StripSubdetector::TEC) )
00059 {
00060 unsigned int amplclus=0;
00061
00062 for(vector<uint8_t>::const_iterator ia=vit->amplitudes().begin(); ia!=vit->amplitudes().end(); ia++)
00063
00064 { if ((*ia)>0) amplclus+=(*ia); }
00065 if(amplclus>ChargeThresholdTEC) nr_clusters_above_threshold++;
00066 }
00067 }
00068 }
00069 if(nr_clusters_above_threshold>=minNrOfTECClusters) decision=true;
00070 std::auto_ptr< int > output_decision( new int(decision) );
00071 e.put(output_decision);
00072 return decision;
00073 }
00074 }