Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

CalMipValsTool Class Reference

calculates Cal Mip values More...

Inheritance diagram for CalMipValsTool:

Inheritance graph
[legend]
Collaboration diagram for CalMipValsTool:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CalMipValsTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~CalMipValsTool ()
StatusCode initialize ()
StatusCode calculate ()
 calculate all values; implemented by each XxxValsTool


Private Attributes

float m_num
float m_x0
float m_y0
float m_z0
float m_xDir
float m_yDir
float m_zDir
float m_d2edge
float m_arcLen
float m_ecor
float m_ecorRms
float m_chi2
float m_erm
float m_ermc
float m_derr
float m_barDist

Detailed Description

calculates Cal Mip values

Author:
F. Piron

Definition at line 57 of file CalMipValsTool.cxx.


Constructor & Destructor Documentation

CalMipValsTool::CalMipValsTool const std::string &  type,
const std::string &  name,
const IInterface *  parent
 

Definition at line 126 of file CalMipValsTool.cxx.

00129                : ValBase( type, name, parent )
00130 {    
00131     // Declare additional interface
00132     declareInterface<IValsTool>(this); 
00133 }

virtual CalMipValsTool::~CalMipValsTool  )  [inline, virtual]
 

Definition at line 64 of file CalMipValsTool.cxx.

00064 { }


Member Function Documentation

StatusCode CalMipValsTool::calculate  )  [virtual]
 

calculate all values; implemented by each XxxValsTool

Reimplemented from ValBase.

Definition at line 167 of file CalMipValsTool.cxx.

References m_arcLen, m_barDist, m_chi2, m_d2edge, m_derr, m_ecor, m_ecorRms, m_erm, m_ermc, m_num, ValBase::m_pEventSvc, m_x0, m_xDir, m_y0, m_yDir, m_z0, and m_zDir.

00168 {
00169     StatusCode sc = StatusCode::SUCCESS;
00170 
00171     // Retrieve the calMipTrack collection   
00172 
00173     MsgStream log(msgSvc(), name());
00174     log << MSG::DEBUG << "FP : readCalMipTrackCol in CalMipValsTool" << endreq;
00175 
00176     SmartDataPtr<Event::CalMipTrackCol> p_calMipTrackCol(m_pEventSvc, EventModel::CalRecon::CalMipTrackCol); 
00177 
00178     Point  point(-1.,-1.,-1.);
00179     Vector dir(-1.,-1.,-1.);
00180     double d2c=-6.;
00181     double d2edge=-6.;
00182     int    calEdge=-6;
00183     double arcLen=-6.;
00184     double ecor=-6.;
00185     double ecorRms=-6.;
00186     double chi2=-6.;
00187     double erm=-6.;
00188     //100 tracks maxi, and 2 criteria :
00189     //   1/ at the CAL boundary
00190     //   2/ Ecor in energy interval given by 25% of MIP Landau function maximum
00191     int ipassed[100][2];
00192     for(int j=0;j<100;j++)
00193     {
00194         ipassed[j][0]=0;
00195         ipassed[j][1]=0;
00196     }
00197     int n1=0,n2=0;
00198 
00199     m_num=0;
00200     m_x0=-5.;
00201     m_y0=-5.;
00202     m_z0=-5.;
00203     m_xDir=-5.;
00204     m_yDir=-5.;
00205     m_zDir=-5.;
00206     m_d2edge=-5.;
00207     m_arcLen=-5.;
00208     m_ecor=-5.;
00209     m_ecorRms=-5.;
00210     m_chi2=-5.;
00211     m_erm=-5.;
00212 
00213     if (p_calMipTrackCol==0)
00214       return sc;
00215     m_num=p_calMipTrackCol->size();
00216     int it=-1;
00217     for(Event::CalMipTrackCol::const_iterator calMipTrackIter=p_calMipTrackCol->begin(); calMipTrackIter != p_calMipTrackCol->end(); calMipTrackIter++)
00218     {
00219         it++;
00220         log << "------------------------------------------------------------" << endreq;
00221         log << "counter col=" << it << " / size = " << m_num << endreq;
00222         Event::CalMipTrack* p_calMipTrack    =  *calMipTrackIter;
00223         p_calMipTrack->writeOut(log);
00224         log << "------------------------------------------------------------" << endreq;
00225 
00226         point   = p_calMipTrack->getPoint   ();
00227         dir     = p_calMipTrack->getDir     ();
00228         d2c     = p_calMipTrack->getD2C     ();
00229         d2edge  = p_calMipTrack->getD2Edge  ();
00230         calEdge = p_calMipTrack->getCalEdge ();
00231         arcLen  = p_calMipTrack->getArcLen  ();
00232         ecor    = p_calMipTrack->getEcor    ();
00233         ecorRms = p_calMipTrack->getEcorRms ();
00234         chi2    = p_calMipTrack->getChi2    ();
00235         erm     = p_calMipTrack->getErm     ();
00236             
00237         if (d2edge<1000000)
00238         {
00239             n1++;
00240             ipassed[it][0]=1;
00241             if (ecor>10.0 && ecor<14.2)
00242             {
00243                 n2++;
00244                 ipassed[it][1]=1;
00245             }
00246         }
00247     }
00248         
00249 //     if (n2<=0)
00250     if (n1<=0)
00251       return sc;
00252     else
00253     {
00254         // loop again over tracks to keep the track with best chi2
00255         int it=-1;
00256         double chi2min=999999;
00257         for(Event::CalMipTrackCol::const_iterator calMipTrackIter=p_calMipTrackCol->begin(); calMipTrackIter != p_calMipTrackCol->end(); calMipTrackIter++)
00258         {
00259             it++;
00260             //        if (!ipassed[it][1])
00261             if (!ipassed[it][0])
00262                 continue;
00263             
00264             Event::CalMipTrack* p_calMipTrack    =  *calMipTrackIter;
00265         
00266             double chi2Cur    = p_calMipTrack->getChi2    ();
00267             if (chi2Cur<chi2min)
00268             {
00269                 chi2min=chi2Cur;
00270                 chi2=chi2Cur;
00271                 point   = p_calMipTrack->getPoint   ();
00272                 dir     = p_calMipTrack->getDir     ();
00273                 d2c     = p_calMipTrack->getD2C     ();
00274                 d2edge  = p_calMipTrack->getD2Edge  ();
00275                 calEdge = p_calMipTrack->getCalEdge ();
00276                 arcLen  = p_calMipTrack->getArcLen  ();
00277                 ecor    = p_calMipTrack->getEcor    ();
00278                 ecorRms = p_calMipTrack->getEcorRms ();
00279                 erm     = p_calMipTrack->getErm     ();
00280             }
00281         }
00282     }
00283     
00284     m_x0=point.x();
00285     m_y0=point.y();
00286     m_z0=point.z();
00287     m_xDir=dir.x();
00288     m_yDir=dir.y();
00289     m_zDir=dir.z();
00290     m_d2edge=d2edge;
00291     m_arcLen=arcLen;
00292     m_ecor=ecor;
00293     m_ecorRms=ecorRms;
00294     m_chi2=chi2;
00295     m_erm=erm;
00296 
00297     //2007-04-05 Sylvain Guiriec
00298 
00299     double ermc=0.;
00300     double derr=0.;
00301     double barDist=0.;
00302 
00303     m_ermc=-100.;
00304     m_derr=-100.;
00305     m_barDist=-100.;
00306 
00307     //Recover EventHeader Pointer
00308     //SmartDataPtr<Event::EventHeader> pEvent(m_pEventSvc, EventModel::EventHeader);
00309 
00310     // Recover Track associated info. 
00311     SmartDataPtr<Event::TkrTrackCol>   pTracks(m_pEventSvc,EventModel::TkrRecon::TkrTrackCol);
00312     if(!pTracks) return sc;
00313 
00314     //SmartDataPtr<Event::TkrVertexCol>  pVerts(m_pEventSvc,EventModel::TkrRecon::TkrVertexCol);
00315     //SmartDataPtr<Event::TkrClusterCol> pClusters(m_pEventSvc,EventModel::TkrRecon::TkrClusterCol);
00316 
00317     // all variable values are preset to zero. Be sure to re-initialize the ones you care about  
00318 
00319     //double die_width = m_tkrGeom->ladderPitch();
00320     //int nDies = m_tkrGeom->nWaferAcross();
00321 
00322     if (!pTracks || n1<=0)
00323       return sc;
00324     else
00325       {
00326         // Count number of tracks
00327         int nTracks = pTracks->size();
00328         int Tkr_No_Tracks   = nTracks;
00329         
00330         if(nTracks < 1) return sc;
00331         
00332         // Get the first Track - it should be the "Best Track"
00333         Event::TkrTrackColConPtr pTrack = pTracks->begin();
00334         
00335         const Event::TkrTrack* track_1 = *pTrack;
00336         
00337         Point  x1 = track_1->getInitialPosition();
00338         Vector t1 = track_1->getInitialDirection();
00339         
00340         float Tkr_1_xdir        = t1.x();
00341         float Tkr_1_ydir        = t1.y();
00342         float Tkr_1_zdir        = t1.z();
00343         
00344         float Tkr_1_x0          = x1.x();
00345         float Tkr_1_y0          = x1.y();
00346         float Tkr_1_z0          = x1.z();
00347 
00348         if (m_arcLen>0)
00349           ermc=m_erm/m_arcLen;
00350         else if (m_arcLen<=0)
00351           ermc=-100.;
00352         //@@@@@
00353         derr=TMath::ACos(m_xDir*Tkr_1_xdir+
00354                                 m_yDir*Tkr_1_ydir+
00355                                 m_zDir*Tkr_1_zdir);
00356         
00357         //@@@@@ Distance between tracker track & calorimeter track's centroid point
00358         double l=(Tkr_1_xdir*(m_x0-Tkr_1_x0)+Tkr_1_ydir*(m_y0-Tkr_1_y0)+Tkr_1_zdir*(m_z0-Tkr_1_z0))/(TMath::Power(Tkr_1_xdir,2)+TMath::Power(Tkr_1_ydir,2)+TMath::Power(Tkr_1_zdir,2));
00359         double Bx   = l*Tkr_1_xdir+Tkr_1_x0;
00360         double By   = l*Tkr_1_ydir+Tkr_1_y0;
00361         double Bz   = l*Tkr_1_zdir+Tkr_1_z0;
00362         barDist = TMath::Sqrt(TMath::Power(m_x0-Bx,2)+TMath::Power(m_y0-By,2)+TMath::Power(m_z0-Bz,2));
00363       }
00364 
00365     m_ermc=ermc;
00366     m_derr=derr;
00367     m_barDist=barDist;
00368 
00369     //2007-04-05 Sylvain Guiriec End  
00370 
00371     log << MSG::DEBUG << " FP : readCalMipTrackCol in CalMipValsTool End  " << m_num << endreq;
00372     return sc;
00373 }

StatusCode CalMipValsTool::initialize  )  [virtual]
 

Reimplemented from ValBase.

Definition at line 135 of file CalMipValsTool.cxx.

References ValBase::addItem(), ValBase::initialize(), m_arcLen, m_barDist, m_chi2, m_d2edge, m_derr, m_ecor, m_ecorRms, m_erm, m_ermc, m_num, m_x0, m_xDir, m_y0, m_yDir, m_z0, and m_zDir.

00136 {
00137     StatusCode sc = StatusCode::SUCCESS;
00138     
00139     MsgStream log(msgSvc(), name());
00140     
00141     if( ValBase::initialize().isFailure()) return StatusCode::FAILURE;
00142 
00143     
00144     addItem("CalMipNum",     &m_num);      
00145     addItem("CalMipX0",      &m_x0);      
00146     addItem("CalMipY0",      &m_y0);      
00147     addItem("CalMipZ0",      &m_z0);      
00148     addItem("CalMipXDir",    &m_xDir);   
00149     addItem("CalMipYDir",    &m_yDir);    
00150     addItem("CalMipZDir",    &m_zDir);    
00151     addItem("CalMipD2edge",  &m_d2edge);  
00152     addItem("CalMipArcLen",  &m_arcLen);  
00153     addItem("CalMipEcor",    &m_ecor);    
00154     addItem("CalMipEcorRms", &m_ecorRms); 
00155     addItem("CalMipChi2",    &m_chi2);    
00156     addItem("CalMipErm",     &m_erm);
00157 
00158     //2007-04-05 Sylvain Guiriec
00159     addItem("CalMipErmc",    &m_ermc);
00160     addItem("CalMipDerr",    &m_derr);
00161     addItem("CalMipBarDist", &m_barDist);
00162     //2007-04-05 Sylvain Guiriec End 
00163     
00164     return sc;
00165 }


Member Data Documentation

float CalMipValsTool::m_arcLen [private]
 

Definition at line 79 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_barDist [private]
 

Definition at line 87 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_chi2 [private]
 

Definition at line 82 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_d2edge [private]
 

Definition at line 78 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_derr [private]
 

Definition at line 86 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_ecor [private]
 

Definition at line 80 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_ecorRms [private]
 

Definition at line 81 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_erm [private]
 

Definition at line 83 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_ermc [private]
 

Definition at line 85 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_num [private]
 

Definition at line 71 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_x0 [private]
 

Definition at line 72 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_xDir [private]
 

Definition at line 75 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_y0 [private]
 

Definition at line 73 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_yDir [private]
 

Definition at line 76 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_z0 [private]
 

Definition at line 74 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().

float CalMipValsTool::m_zDir [private]
 

Definition at line 77 of file CalMipValsTool.cxx.

Referenced by calculate(), and initialize().


The documentation for this class was generated from the following file:
Generated on Mon Dec 1 20:09:09 2008 by doxygen 1.3.3