CMS 3D CMS Logo

ClusterFP420 Class Reference

#include <DataFormats/FP420Cluster/interface/ClusterFP420.h>

List of all members.

Public Types

typedef std::vector
< HDigiFP420 >::const_iterator 
HDigiFP420Iter
typedef std::pair
< HDigiFP420Iter,
HDigiFP420Iter
HDigiFP420Range

Public Member Functions

const std::vector< short > & amplitudes () const
float barycenter () const
float barycenterW () const
float barycerror () const
float barycerrorW () const
 ClusterFP420 (unsigned int, unsigned int, const HDigiFP420Range &, float &, float &)
 ClusterFP420 ()
short firstStrip () const
unsigned int globalId () const

Private Attributes

std::vector< short > amplitudes_
float barycenter_
float barycenterW_
float barycerror_
float barycerrorW_
unsigned int detId_
short firstStrip_


Detailed Description

Definition at line 7 of file ClusterFP420.h.


Member Typedef Documentation

typedef std::vector<HDigiFP420>::const_iterator ClusterFP420::HDigiFP420Iter

Definition at line 10 of file ClusterFP420.h.

typedef std::pair<HDigiFP420Iter,HDigiFP420Iter> ClusterFP420::HDigiFP420Range

Definition at line 11 of file ClusterFP420.h.


Constructor & Destructor Documentation

ClusterFP420::ClusterFP420 (  )  [inline]

Definition at line 14 of file ClusterFP420.h.

00014 : detId_(0)  {}

ClusterFP420::ClusterFP420 ( unsigned int  detid,
unsigned int  zside,
const HDigiFP420Range range,
float &  cog,
float &  err 
)

The barycenter of the cluster, not corrected for Lorentz shift; it can means that should not be used as position estimate for tracking.

Definition at line 23 of file ClusterFP420.cc.

References a, amplitudes_, barycenter_, barycenterW_, barycerror_, barycerrorW_, const_ps1s2, constW_ps1s2, GenMuonPlsPt100GeV_cfg::cout, detId_, lat::endl(), firstStrip_, i, and funct::sqrt().

00024                                                        :
00025   detId_(detid), firstStrip_(range.first->strip())
00026 //  detId_(detid), zside_(zside), firstStrip_(range.first->strip())
00027 {
00028   // For the range of strips in cluster assign adc(,its numbers i->strip()) calculate cog... 
00029   // strip   :    0-400 or 0-250
00030 #ifdef mydigidebug11
00031    std::cout << "===================================== firstStrip = " << firstStrip_ << std::endl;
00032    std::cout << "==range.first->strip() = " << range.first->strip() << std::endl;
00033    std::cout << "==range.second->strip() = " << range.second->strip() << std::endl;
00034 #endif
00035 
00036   amplitudes_.reserve( range.second - range.first);
00037 
00038 
00039   int striprange = 0;
00040   float sumx = 0.;
00041   float sumxx = 0.;
00042   float sumy = 0.;
00043   float sumyy = 0.;
00044   int suma = 0;
00045 
00046 //  int lastStrip = -1;
00047   for (HDigiFP420Iter i=range.first; i!=range.second; i++) {
00048     striprange++;
00049 #ifdef mydigidebug11
00050    std::cout << " current striprange = " << striprange << std::endl;
00051 #endif
00052    /*
00054       if (i!=ibeg && (difNarr(zside,i,i-1) > 1 || difWide(zside,i,i-1) > 1)   ){
00055     if (lastStrip>0 && i->strip() != lastStrip + 1) {
00056                  for (int j=0; j < i->strip()-(lastStrip+1); j++) {
00057                    amplitudes_.push_back( 0);
00058                  }
00059     }
00060     lastStrip = i->strip();
00061 */
00062     short amp = i->adc();       // FIXME: gain correction here
00063 
00064 #ifdef mydigidebug11
00065    std::cout << " current strip = " << i->strip() << "  amp = " << amp << std::endl;
00066 #endif
00067 
00068     amplitudes_.push_back(amp);
00069     if(zside == 1) {
00070       sumx += i->stripH()*amp;
00071       sumy += i->stripHW()*amp;
00072       suma += amp;
00073       sumxx += (i->stripH()) * (i->stripH()) * amp;
00074       sumyy += (i->stripHW()) * (i->stripHW()) * amp;
00075     }
00076     else if(zside == 2) {
00077       sumx += i->stripV()*amp;
00078       sumy += i->stripVW()*amp;
00079       suma += amp;
00080       sumxx += (i->stripV()) * (i->stripV()) * amp;
00081       sumyy += (i->stripVW()) * (i->stripVW()) * amp;
00082     }
00083     else {
00084       std::cout << " ClusterFP420: wrong zside = " << zside << std::endl;
00085     }
00086 
00087 #ifdef mydigidebug11
00088    std::cout << " current sumx = " << sumx << std::endl;
00089    std::cout << " current sumy = " << sumy << std::endl;
00090    std::cout << " current suma = " << suma << std::endl;
00091    std::cout << " current barycenter = " << (sumx / static_cast<float>(suma) )  << std::endl;
00092    std::cout << " current barycenterW= " << (sumy / static_cast<float>(suma) )  << std::endl;
00093 #endif
00094   } //for i
00095 
00096 
00097   if(suma != 0) {
00098     barycenter_ = sumx / static_cast<float>(suma) ;
00099     barycerror_ = sumxx / static_cast<float>(suma) ;
00100     barycerror_ = fabs(barycerror_ - barycenter_*barycenter_) ;
00101 #ifdef mydigidebug11
00102     std::cout << "barycerror_ = " << barycerror_ << "barycenter_ = " << barycenter_ << std::endl;
00103 #endif
00104     barycenterW_ = sumy / static_cast<float>(suma) ;
00105     barycerrorW_ = sumyy / static_cast<float>(suma) ;
00106     barycerrorW_ = fabs(barycerrorW_ - barycenterW_*barycenterW_) ;
00107 #ifdef mydigidebug11
00108     std::cout << "barycerrorW_ = " << barycerrorW_ << "barycenterW_ = " << barycenterW_ << std::endl;
00109 #endif
00110   }
00111   else{
00112     barycenter_ = 1000000. ;
00113     barycerror_ = 1000000. ;
00114     barycenterW_ = 1000000. ;
00115     barycerrorW_ = 1000000. ;
00116   }
00117 
00121   cog = barycenter_;// cog for Narrow pixels only
00122 
00123 #ifdef mydigidebug11
00124    std::cout << "AT end: barycenter_ = " << barycenter_ << std::endl;
00125    std::cout << "AT end:  striprange = " << striprange << std::endl;
00126 #endif
00127 
00128 
00129 
00130 
00131 
00132    /*
00133 
00134   float sumx0 = 0.;
00135   float sumxx = 0.;
00136   lastStrip = -1;
00137   for (HDigiFP420Iter i=range.first; i!=range.second; i++) {
00138 #ifdef mydigidebug11
00139    std::cout << " current striprange = " << striprange << std::endl;
00140 #endif
00142     if (lastStrip>0 && i->strip() != lastStrip + 1) {
00143                  for (int j=0; j < i->strip()-(lastStrip+1); j++) {
00144                    amplitudes_.push_back( 0);
00145                  }
00146     }
00147     lastStrip = i->strip();
00148 
00149     short amp = i->adc();       // FIXME: gain correction here
00150 
00151 #ifdef mydigidebug11
00152    std::cout << " current strip = " << i->strip() << "  amp = " << amp << std::endl;
00153 #endif
00154 
00155     sumx0 += (i->strip()-cog)*amp;
00156     sumxx += (i->strip()-cog) * (i->strip()-cog) * amp;
00157 
00158 
00159 #ifdef mydigidebug11
00160    std::cout << " 2 current sumx0 = " << sumx0 << std::endl;
00161    std::cout << " 2 current sumxx = " << sumxx << std::endl;
00162 #endif
00163   } //for
00164 
00165 
00166   if(suma != 0) {
00167     sumx0 = sumx0 / static_cast<float>(suma) ;
00168     sumxx = sumxx / static_cast<float>(suma);
00169     
00170     //barycerror_ = fabs(sumxx - sumx0*sumx0) ;
00171 
00172     //barycerror_ = (sumxx - sumx0*sumx0) ;
00173     //barycerror_ *= barycerror_ ;
00174 
00175       barycerror_ = sumxx ;
00176 
00177   }
00178   else{
00179     barycerror_ = 1000000. ;
00180   }
00181 
00182 */
00183 
00184 #ifdef mydigidebug10
00185    std::cout << "pitchcommon = " << const_ps1s2[0] << " sigma1= " << const_ps1s2[1]  << " sigma2= " << const_ps1s2[2]  << std::endl;
00186 #endif
00187 
00188    //
00189   if(barycerror_ == 0.0) {
00190     barycerror_ = const_ps1s2[1]/const_ps1s2[0];// 
00191   }
00192   else{
00193     barycerror_ = const_ps1s2[2]/const_ps1s2[0];//  
00194   }
00195     barycerror_ *= barycerror_;
00196    //
00197   if(barycerrorW_ == 0.0) {
00198     barycerrorW_ = constW_ps1s2[1]/constW_ps1s2[0];// 
00199   }
00200   else{
00201     barycerrorW_ = constW_ps1s2[2]/constW_ps1s2[0];// 
00202   }
00203     barycerrorW_ *= barycerrorW_;
00204    //
00205 
00206 #ifdef mydigidebug11
00207    std::cout << "barycerror_ = " << barycerror_ << "barycerrorW_ = " << barycerrorW_ << std::endl;
00208 #endif
00209          
00210    // change by hands:
00211 
00212         // number of station
00213         int  mysn0 = 2;
00214         
00215         // number of planes 
00216         int  mypn0 = 5;
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224   // unpack from detId_:
00225         int  sScale = 2*mypn0;
00226         //      int  zScale=2;
00227         int  sector = (detId_-1)/sScale + 1 ;
00228         //      int  zmodule = (detId_ - (sector - 1)*sScale - 1) /zScale + 1 ;
00230         float a = 0.00001;
00231 
00232 
00233         if(mysn0 == 2) {
00234           if(sector==2) {
00235             a = 0.0026+((0.0075-0.0026)/7.)*(mypn0-2); // 8 m 
00236               }
00237         }
00238         else if(mysn0 == 3) {
00239           if(sector==2) {
00240             a = 0.0011+((0.0030-0.0011)/7.)*(mypn0-2); // 4 m 
00241               }
00242           else if(sector==3) {
00243             a = 0.0022+((0.0068-0.0022)/7.)*(mypn0-2); // 8 m 
00244               }
00245         }
00246         else if(mysn0 == 4) {
00247           if(sector==2) {
00248             a = 0.0009+((0.0024-0.0009)/7.)*(mypn0-2); // 2.7 m 
00249               }
00250           else if(sector==3) {
00251             a = 0.0018+((0.0050-0.0018)/7.)*(mypn0-2); // 5.4 m 
00252               }
00253           else if(sector==4) {
00254             a = 0.0026+((0.0075-0.0026)/7.)*(mypn0-2); // 8.1 m 
00255               }
00256         }
00257 
00258         //      barycerror_+=a*a;
00259         //      barycerrorW_+=a*a;
00260         barycerror_+=a*a/const_ps1s2[0]/const_ps1s2[0];
00261         barycerrorW_+=a*a/constW_ps1s2[0]/constW_ps1s2[0];
00262 
00263     /*
00264 
00265   if(detId_ < 21) {
00266     float a = 0.0001*(int((detId_-1)/2.)+1)/pitchall;
00267     barycerror_+=a*a;
00268   }
00269   else if(detId_ < 41) {
00270     float a = 0.0001*(int((detId_-21)/2.)+1)/pitchall;
00271            a +=0.0036; // 2.5 m
00272     //          a +=0.0052; // 4 m
00273     //  a +=0.0131;// 8. m
00274     barycerror_+=a*a;
00275   }
00276   else if(detId_ < 61) {
00277     float a = 0.0001*(int((detId_-41)/2.)+1)/pitchall;
00278              a +=0.0069;// 5 m  0.0059
00279     //          a +=0.0101;// 8. m
00280     //  a +=0.0241;// 16. m
00281     barycerror_+=a*a;
00282   }
00283   else if(detId_ < 81) {
00284     float a = 0.0001*(int((detId_-61)/2.)+1)/pitchall;
00285           a +=0.0131;// 7.5 m   0.0111
00286     //       a +=0.0151;// 12. m
00287     //  a +=0.0301;// 24. m
00288     barycerror_+=a*a;
00289   }
00290 */
00291 #ifdef mydigidebug11
00292    std::cout << "AT end: barycerror_ = " << barycerror_ << std::endl;
00293 #endif
00294 
00295   barycerror_ = sqrt(  barycerror_ );
00296   err = barycerror_;
00297 
00298   barycerrorW_ = sqrt(  barycerrorW_ );
00299 
00300 
00301 #ifdef mydigidebug11
00302    std::cout << "AT end: err = " << err<< "   detId_= " << detId_ << std::endl;
00303 #endif
00304 
00305 }


Member Function Documentation

const std::vector<short>& ClusterFP420::amplitudes (  )  const [inline]

Definition at line 29 of file ClusterFP420.h.

References amplitudes_.

Referenced by FP420ClusterMain::run().

00029 {return amplitudes_;}

float ClusterFP420::barycenter (  )  const [inline]

Definition at line 31 of file ClusterFP420.h.

References barycenter_.

Referenced by FP420ClusterMain::run(), and TrackProducerFP420::trackFinderSophisticated().

00031 {return barycenter_;}

float ClusterFP420::barycenterW (  )  const [inline]

Definition at line 34 of file ClusterFP420.h.

References barycenterW_.

Referenced by FP420ClusterMain::run(), and TrackProducerFP420::trackFinderSophisticated().

00034 {return barycenterW_;}

float ClusterFP420::barycerror (  )  const [inline]

Definition at line 32 of file ClusterFP420.h.

References barycerror_.

Referenced by TrackProducerFP420::trackFinderSophisticated().

00032 {return barycerror_;}

float ClusterFP420::barycerrorW (  )  const [inline]

Definition at line 35 of file ClusterFP420.h.

References barycerrorW_.

Referenced by TrackProducerFP420::trackFinderSophisticated().

00035 {return barycerrorW_;}

short ClusterFP420::firstStrip (  )  const [inline]

Definition at line 21 of file ClusterFP420.h.

References firstStrip_.

Referenced by operator<(), and FP420ClusterMain::run().

00021 {return firstStrip_;}

unsigned int ClusterFP420::globalId (  )  const [inline]

Definition at line 24 of file ClusterFP420.h.

References detId_.

Referenced by operator<().

00024 {return detId_;}


Member Data Documentation

std::vector<short> ClusterFP420::amplitudes_ [private]

Definition at line 42 of file ClusterFP420.h.

Referenced by amplitudes(), and ClusterFP420().

float ClusterFP420::barycenter_ [private]

Definition at line 43 of file ClusterFP420.h.

Referenced by barycenter(), and ClusterFP420().

float ClusterFP420::barycenterW_ [private]

Definition at line 45 of file ClusterFP420.h.

Referenced by barycenterW(), and ClusterFP420().

float ClusterFP420::barycerror_ [private]

Definition at line 44 of file ClusterFP420.h.

Referenced by barycerror(), and ClusterFP420().

float ClusterFP420::barycerrorW_ [private]

Definition at line 46 of file ClusterFP420.h.

Referenced by barycerrorW(), and ClusterFP420().

unsigned int ClusterFP420::detId_ [private]

Definition at line 39 of file ClusterFP420.h.

Referenced by ClusterFP420(), and globalId().

short ClusterFP420::firstStrip_ [private]

Definition at line 41 of file ClusterFP420.h.

Referenced by ClusterFP420(), and firstStrip().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:21 2009 for CMSSW by  doxygen 1.5.4