LIPatternFinderSimple Class Reference

#include <LIPatternFinderSimple.h>

Inheritance diagram for LIPatternFinderSimple:
LIPatternFinder

List of all members.

Public Member Functions

 LIPatternFinderSimple ()
 ~LIPatternFinderSimple ()
void DefaultConfig (void)
void Configure (const Registry &registry)
bool IsLightInjectionTrash (CandDigitListHandle *cdlh)

Private Member Functions

double GetEWAsymmetry (const vector< CandDigitHandle * > &digits) const
double GetTotalCharge (const vector< CandDigitHandle * > &digits) const
vector< double > ActivityBetweenCrateBoundaries (const vector< CandDigitHandle * > &digits) const
double FractionOfActivePlanesInRange (int pl_min, int pl_max, const vector< CandDigitHandle * > &digits) const
void PrintSnarl (const vector< CandDigitHandle * > &digits) const

Private Attributes

double fMaxEWAsymmetry
double fPulseHeightThreshold
double fMaxNDigits
double fMaxCharge
double fHighActivityThreshold
double fLowActivityThreshold

Detailed Description

Definition at line 46 of file LIPatternFinderSimple.h.


Constructor & Destructor Documentation

LIPatternFinderSimple::LIPatternFinderSimple (  ) 

Definition at line 118 of file LIPatternFinderSimple.cxx.

References DefaultConfig(), Msg::kVerbose, and MSG.

00119 {
00120   MSG("LIPatternFinder", Msg::kVerbose)
00121                                      << "LIPatternFinderSimple ctor\n";
00122   DefaultConfig();
00123 }

LIPatternFinderSimple::~LIPatternFinderSimple (  ) 

Definition at line 125 of file LIPatternFinderSimple.cxx.

References Msg::kVerbose, and MSG.

00126 {
00127   MSG("LIPatternFinder", Msg::kVerbose)
00128                                      << "LIPatternFinderSimple dtor\n";
00129 }


Member Function Documentation

vector< double > LIPatternFinderSimple::ActivityBetweenCrateBoundaries ( const vector< CandDigitHandle * > &  digits  )  const [private]

Definition at line 299 of file LIPatternFinderSimple.cxx.

References FractionOfActivePlanesInRange().

Referenced by IsLightInjectionTrash().

00301 {
00302   vector<double> active_fraction;
00303 
00304   const int kNDetectorSegments = 8;
00305   
00306   const int kMinPlane[kNDetectorSegments] = {
00307                                1,  65, 129, 193, 250, 314, 378, 442 };
00308   const int kMaxPlane[kNDetectorSegments] = {
00309                               64, 128, 192, 248, 313, 377, 441, 485 };
00310 
00311   for(int isegment = 0; isegment < kNDetectorSegments; isegment++)
00312          active_fraction.push_back(
00313               FractionOfActivePlanesInRange(
00314                    kMinPlane[isegment], kMaxPlane[isegment], digits) );
00315                 
00316   return active_fraction;
00317 }

void LIPatternFinderSimple::Configure ( const Registry registry  )  [virtual]

Implements LIPatternFinder.

Definition at line 143 of file LIPatternFinderSimple.cxx.

References fHighActivityThreshold, fLowActivityThreshold, fMaxCharge, fMaxEWAsymmetry, fMaxNDigits, fPulseHeightThreshold, and Registry::Get().

00144 {
00145   double tmpd;
00146   
00147   if (registry.Get("MaxEWAsymmetry", tmpd))    fMaxEWAsymmetry = tmpd;
00148   if (registry.Get("MaxNDigits", tmpd))            fMaxNDigits = tmpd;
00149   if (registry.Get("MaxCharge", tmpd))              fMaxCharge = tmpd;
00150   if (registry.Get("PulseHeightThreshold", tmpd))
00151                                          fPulseHeightThreshold = tmpd;
00152   if (registry.Get("HighActivityThreshold", tmpd))
00153                                         fHighActivityThreshold = tmpd;
00154   if (registry.Get("LowActivityThreshold", tmpd))
00155                                          fLowActivityThreshold = tmpd;
00156 }

void LIPatternFinderSimple::DefaultConfig ( void   )  [virtual]

Implements LIPatternFinder.

Definition at line 131 of file LIPatternFinderSimple.cxx.

References fHighActivityThreshold, fLowActivityThreshold, fMaxCharge, fMaxEWAsymmetry, fMaxNDigits, and fPulseHeightThreshold.

Referenced by LIPatternFinderSimple().

00132 {
00133   // see header file for comments on variables
00134   
00135   fMaxEWAsymmetry               = 5.e+5; 
00136   fPulseHeightThreshold         = 200; 
00137   fMaxNDigits                   = 1000;
00138   fMaxCharge                    = 1.e+6;
00139   fHighActivityThreshold        = 0.90;
00140   fLowActivityThreshold         = 0.20;
00141 }

double LIPatternFinderSimple::FractionOfActivePlanesInRange ( int  pl_min,
int  pl_max,
const vector< CandDigitHandle * > &  digits 
) const [private]

Definition at line 274 of file LIPatternFinderSimple.cxx.

References fPulseHeightThreshold.

Referenced by ActivityBetweenCrateBoundaries().

00277 {
00278 // returns the fraction of active planes in the range [pl_min, pl_max]
00279 
00280   int n_total_planes  = 1 + plane_max - plane_min;
00281   int n_active_planes = 0;
00282   
00283   assert(n_total_planes > 0);
00284 
00285   for(int plane = plane_min; plane < plane_max; plane++) {
00286 
00287     int n_digits = count_if(digits.begin(), digits.end(),
00288               is_in_plane_and_above_thr(plane, fPulseHeightThreshold));
00289 
00290     if(n_digits > 0) n_active_planes++;  
00291   }
00292 
00293   double fraction = (double) n_active_planes / (double) n_total_planes;
00294 
00295   return fraction;
00296 }

double LIPatternFinderSimple::GetEWAsymmetry ( const vector< CandDigitHandle * > &  digits  )  const [private]

Definition at line 231 of file LIPatternFinderSimple.cxx.

References copy(), Msg::kVerbose, and MSG.

Referenced by IsLightInjectionTrash().

00233 {
00234 // returns the net |WEST side - EAST side| charge
00235   
00236   //-- copy input vector
00237 
00238   vector<CandDigitHandle *> digits_cp( digits.size() );
00239   
00240   copy( digits.begin(), digits.end(), digits_cp.begin() );
00241 
00242   //-- East-West partition
00243   
00244   vector<CandDigitHandle *>::iterator part_iter = partition(
00245                  digits_cp.begin(), digits_cp.end(), is_east_side() );
00246 
00247   //-- accumulate charge
00248   
00249   double q_east = accumulate(
00250                           digits_cp.begin(), part_iter, 0.0, sum_q());
00251   double q_west = accumulate(
00252                           part_iter, digits_cp.end(), 0.0, sum_q());
00253 
00254   MSG("LIPatternFinder", Msg::kVerbose) << "Q_W = " << q_west << endl;
00255   MSG("LIPatternFinder", Msg::kVerbose) << "Q_E = " << q_east << endl;
00256                           
00257   //-- calculate asymmetry
00258 
00259   double asymmetry = fabs(q_west-q_east);
00260 
00261   return asymmetry; 
00262 }

double LIPatternFinderSimple::GetTotalCharge ( const vector< CandDigitHandle * > &  digits  )  const [private]

Definition at line 264 of file LIPatternFinderSimple.cxx.

Referenced by IsLightInjectionTrash().

00266 {
00267 // returns the total charge
00268 
00269   double q = accumulate(digits.begin(), digits.end(), 0.0, sum_q());
00270 
00271   return q;
00272 }

bool LIPatternFinderSimple::IsLightInjectionTrash ( CandDigitListHandle cdlh  )  [virtual]

Implements LIPatternFinder.

Definition at line 158 of file LIPatternFinderSimple.cxx.

References ActivityBetweenCrateBoundaries(), digit(), digits(), fHighActivityThreshold, fLowActivityThreshold, fMaxCharge, fMaxEWAsymmetry, fMaxNDigits, CandHandle::GetDaughterIterator(), GetEWAsymmetry(), GetTotalCharge(), Msg::kVerbose, and MSG.

00160 {
00161   MSG("LIPatternFinder", Msg::kVerbose)
00162                             << "LIPatternFinderSimple running" << endl;
00163 
00164   CandDigitHandleItr cdh_iter ( cdlh->GetDaughterIterator() );
00165 
00166   vector<CandDigitHandle *> digits;
00167   
00168   while ( CandDigitHandle * digit = cdh_iter.Ptr() ) {
00169 
00170     digits.push_back(digit);
00171         
00172     cdh_iter.Next();
00173   }
00174 
00175   sort(digits.begin(), digits.end(), min_plane()); // sort in pl.-nu.
00176   
00177   //PrintSnarl(digits);
00178 
00179   double asymmetry  = GetEWAsymmetry(digits);
00180   double tot_charge = GetTotalCharge(digits);
00181 
00182   vector<double> segment_activity =
00183                                 ActivityBetweenCrateBoundaries(digits);
00184 
00185   sort(segment_activity.begin(), segment_activity.end());
00186 
00187   double first_max  = segment_activity[ segment_activity.size()-1 ];
00188   double second_max = segment_activity[ segment_activity.size()-2 ];
00189   
00190   MSG("LIPatternFinder", Msg::kVerbose)
00191           << "------------------------- LIPatternFinderSimple summary:"
00192           << endl;             
00193   MSG("LIPatternFinder", Msg::kVerbose)
00194                            << "E-W Asymmetry  = " << asymmetry << endl;
00195   MSG("LIPatternFinder", Msg::kVerbose)
00196                             << "N-Digits  = " << digits.size() << endl;
00197   MSG("LIPatternFinder", Msg::kVerbose)
00198                            << "Total charge  = " << tot_charge << endl;
00199   MSG("LIPatternFinder", Msg::kVerbose)
00200        << "Fraction of active planes between crate boundaries" << endl;
00201   MSG("LIPatternFinder", Msg::kVerbose)
00202                             << "    - 1st max = " << first_max << endl;
00203   MSG("LIPatternFinder", Msg::kVerbose)
00204                            << "    - 2nd max = " << second_max << endl;
00205 
00206   //-- check for large EAST-WEST asymmetry
00207   bool exceeds_max_EW_asymmetry = (asymmetry     > fMaxEWAsymmetry);
00208 
00209   //-- check if event exceeds a maximum number of digits
00210   bool exceeds_max_n_digits     = (digits.size() > fMaxNDigits);
00211 
00212   //-- check if event exceeds a maximum charge
00213   bool exceeds_max_charge       = (tot_charge    > fMaxCharge);
00214 
00215   //-- check if event activity is confined to a single segment (=
00216   //   area between two crate boundaries). To do this I have
00217   //   calculated the fraction of active planes in each segment
00218   //   and check whether the 1st maximum is very high while the
00219   //   2nd maximum is low.
00220   bool shows_segment_asymmetry  =
00221                (first_max  > fHighActivityThreshold) && 
00222                                  (second_max < fLowActivityThreshold);
00223 
00224   bool is_LI = exceeds_max_EW_asymmetry &&
00225                           exceeds_max_n_digits &&
00226                                     exceeds_max_charge &&
00227                                               shows_segment_asymmetry;  
00228   return is_LI;
00229 }

void LIPatternFinderSimple::PrintSnarl ( const vector< CandDigitHandle * > &  digits  )  const [private]

Definition at line 319 of file LIPatternFinderSimple.cxx.

References RawChannelId::GetCrate(), PlexSEIdAltL::GetEnd(), PlexSEIdAltL::GetPlane(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), Msg::kVerbose, and MSG.

00321 {
00322   vector<CandDigitHandle *>::const_iterator digit_iter;
00323 
00324   for(digit_iter = digits.begin();
00325                             digit_iter != digits.end(); ++digit_iter) {
00326 
00327     const PlexSEIdAltL & seid = (*digit_iter)->GetPlexSEIdAltL();
00328     RawChannelId rawchid = (*digit_iter)->GetChannelId();
00329     
00330     MSG("LIPatternFinder", Msg::kVerbose)
00331          << " PL = "    << seid.GetPlane()
00332          << " END = "   << seid.GetEnd()
00333          << " CRATE = " << rawchid.GetCrate()
00334          << " VARC = "  << rawchid.GetVarcId()
00335          << " VMM = "   << rawchid.GetVmm()    
00336          << " Q = "     << (*digit_iter)->GetCharge() << endl;
00337   }
00338 }


Member Data Documentation

Definition at line 78 of file LIPatternFinderSimple.h.

Referenced by Configure(), DefaultConfig(), and IsLightInjectionTrash().

Definition at line 79 of file LIPatternFinderSimple.h.

Referenced by Configure(), DefaultConfig(), and IsLightInjectionTrash().

Definition at line 77 of file LIPatternFinderSimple.h.

Referenced by Configure(), DefaultConfig(), and IsLightInjectionTrash().

Definition at line 74 of file LIPatternFinderSimple.h.

Referenced by Configure(), DefaultConfig(), and IsLightInjectionTrash().

Definition at line 76 of file LIPatternFinderSimple.h.

Referenced by Configure(), DefaultConfig(), and IsLightInjectionTrash().

Definition at line 75 of file LIPatternFinderSimple.h.

Referenced by Configure(), DefaultConfig(), and FractionOfActivePlanesInRange().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1