Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #include "HLTrigger/special/interface/HLTPixelAsymmetryFilter.h"
00012
00013
00014
00015
00016
00017 HLTPixelAsymmetryFilter::HLTPixelAsymmetryFilter(const edm::ParameterSet& config) :
00018 inputTag_ (config.getParameter<edm::InputTag>("inputTag")),
00019 saveTag_ (config.getUntrackedParameter<bool>("saveTag", false)),
00020 min_asym_ (config.getParameter<double>("MinAsym")),
00021 max_asym_ (config.getParameter<double>("MaxAsym")),
00022 clus_thresh_ (config.getParameter<double>("MinCharge")),
00023 bmincharge_ (config.getParameter<double>("MinBarrel"))
00024 {
00025 LogDebug("") << "Using the " << inputTag_ << " input collection";
00026 LogDebug("") << "Requesting events with a charge repartition asymmetry between " << min_asym_ << " and " << max_asym_;
00027 LogDebug("") << "Mean cluster charge in the barrel should be higher than" << bmincharge_ << " electrons ";
00028 LogDebug("") << "Only clusters with a charge larger than " << clus_thresh_ << " electrons will be used ";
00029
00030
00031 produces<trigger::TriggerFilterObjectWithRefs>();
00032 }
00033
00034 HLTPixelAsymmetryFilter::~HLTPixelAsymmetryFilter()
00035 {
00036 }
00037
00038
00039
00040
00041
00042
00043 bool HLTPixelAsymmetryFilter::filter(edm::Event& event, const edm::EventSetup& iSetup)
00044 {
00045
00046
00047
00048
00049
00050 std::auto_ptr<trigger::TriggerFilterObjectWithRefs> filterobject (new trigger::TriggerFilterObjectWithRefs(path(),module()));
00051 if (saveTag_) filterobject->addCollectionTag(inputTag_);
00052
00053
00054 edm::Handle<edmNew::DetSetVector<SiPixelCluster> > clusterColl;
00055 event.getByLabel(inputTag_, clusterColl);
00056
00057 unsigned int clusterSize = clusterColl->dataSize();
00058 LogDebug("") << "Number of clusters accepted: " << clusterSize;
00059
00060 bool accept = (clusterSize >= 2);
00061
00062 if (!accept) return accept;
00063
00064 double asym_pix_1 = -1;
00065 double asym_pix_2 = -1;
00066
00067 int n_clus[3] = {0,0,0};
00068 double e_clus[3] = {0.,0.,0.};
00069
00070 for (edmNew::DetSetVector<SiPixelCluster>::const_iterator DSViter=clusterColl->begin(); DSViter!=clusterColl->end();DSViter++ )
00071 {
00072 edmNew::DetSet<SiPixelCluster>::const_iterator begin=DSViter->begin();
00073 edmNew::DetSet<SiPixelCluster>::const_iterator end =DSViter->end();
00074 uint32_t detid = DSViter->id();
00075
00076 bool barrel = DetId(detid).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00077 bool endcap = DetId(detid).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00078
00079 int detpos = -1;
00080
00081
00082
00083
00084 if (endcap)
00085 {
00086 PixelEndcapName::HalfCylinder position = PixelEndcapName(DetId(detid)).halfCylinder();
00087
00088 if (position == PixelEndcapName::mI || position == PixelEndcapName::mO)
00089 detpos = 0;
00090
00091 if (position == PixelEndcapName::pI || position == PixelEndcapName::pO)
00092 detpos = 2;
00093 }
00094
00095 if (barrel)
00096 detpos = 1;
00097
00098 if (detpos<0) continue;
00099
00100 for(edmNew::DetSet<SiPixelCluster>::const_iterator iter=begin;iter!=end;++iter)
00101 {
00102 if (iter->charge()>clus_thresh_ )
00103 {
00104 ++n_clus[detpos];
00105 e_clus[detpos]+=iter->charge();
00106 }
00107 }
00108 }
00109
00110 for (int i=0;i<3;++i)
00111 {
00112 if (n_clus[i])
00113 e_clus[i] /= n_clus[i];
00114 }
00115
00116 if (e_clus[1] < bmincharge_) return false;
00117
00118
00119 if (e_clus[0]+e_clus[2] != 0)
00120 {
00121 asym_pix_1 = e_clus[0]/(e_clus[0]+e_clus[2]);
00122 asym_pix_2 = e_clus[2]/(e_clus[0]+e_clus[2]);
00123 }
00124 else
00125 {
00126 return false;
00127 }
00128
00129 bool pkam_1 = (asym_pix_1 <= max_asym_ && asym_pix_1 >= min_asym_);
00130 bool pkam_2 = (asym_pix_2 <= max_asym_ && asym_pix_2 >= min_asym_);
00131
00132 if (pkam_1 || pkam_2) return accept;
00133
00134 return false;
00135 }