Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

AlgFarDetShieldPlank Class Reference

#include <AlgFarDetShieldPlank.h>

Inheritance diagram for AlgFarDetShieldPlank:

AlgBase List of all members.

Public Member Functions

 AlgFarDetShieldPlank ()
virtual ~AlgFarDetShieldPlank ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void Trace (const char *c) const

Constructor & Destructor Documentation

AlgFarDetShieldPlank::AlgFarDetShieldPlank  ) 
 

Definition at line 24 of file AlgFarDetShieldPlank.cxx.

References MSG.

00025 {
00026   MSG("FarDetShieldPlank",Msg::kVerbose) << " *** AlgFarDetShieldPlank::AlgFarDetShieldPlank() *** " << endl;
00027 
00028 }

AlgFarDetShieldPlank::~AlgFarDetShieldPlank  )  [virtual]
 

Definition at line 30 of file AlgFarDetShieldPlank.cxx.

References MSG.

00031 {
00032   MSG("FarDetShieldPlank",Msg::kVerbose) << " *** AlgFarDetShieldPlank::~AlgFarDetShieldPlank() *** " << endl;
00033   
00034 }


Member Function Documentation

void AlgFarDetShieldPlank::RunAlg AlgConfig ac,
CandHandle ch,
CandContext cx
[virtual]
 

Implements AlgBase.

Definition at line 36 of file AlgFarDetShieldPlank.cxx.

References CandHandle::AddDaughterLink(), UgliStripHandle::ClearFiber(), CandContext::GetCandRecord(), FarDetShieldPlankHandle::GetCharge(), CandDigitHandle::GetCharge(), CandContext::GetDataIn(), PlexSEIdAltL::GetEnd(), UgliStripHandle::GetHalfLength(), CandHandle::GetNDaughters(), FarDetShieldPlankHandle::GetPlane(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), FarDetShieldPlankHandle::GetSection(), UgliGeomHandle::GetStripHandle(), FarDetShieldPlankHandle::GetSubSection(), CandDigitHandle::GetSubtractedTime(), FarDetShieldPlankHandle::GetTime(), RecMinos::GetVldContext(), UgliStripHandle::GlobalPos(), UgliStripHandle::IsValid(), MSG, FarDetShieldPlankHandle::SetCharge(), FarDetShieldPlankHandle::SetCorrectedTime(), FarDetShieldPlankHandle::SetFibreLengths(), FarDetShieldPlankHandle::SetGeomErrors(), FarDetShieldPlankHandle::SetNStrips(), FarDetShieldPlankHandle::SetPlane(), FarDetShieldPlankHandle::SetSection(), FarDetShieldPlankHandle::SetSubSection(), FarDetShieldPlankHandle::SetTime(), FarDetShieldPlankHandle::SetX(), FarDetShieldPlankHandle::SetY(), FarDetShieldPlankHandle::SetZ(), and UgliStripHandle::WlsPigtail().

00038 {
00039   MSG("FarDetShieldPlank",Msg::kVerbose) << " *** AlgFarDetShieldPlank::RunAlg(...) *** " << endl;
00040 
00041   FarDetShieldPlankHandle& myplank = dynamic_cast<FarDetShieldPlankHandle&>(ch);
00042 
00043   Double_t indx=1.77;
00044   Int_t i,j;
00045   Double_t halflength;
00046 
00047   const TObjArray* myarray = dynamic_cast<const TObjArray*>(cx.GetDataIn());
00048   CandRecord* candrec = (CandRecord*)(cx.GetCandRecord());
00049   VldContext* vldc = (VldContext*)(candrec->GetVldContext());
00050   UgliGeomHandle ugh(*vldc);
00051   PlexHandle ph(*vldc);
00052 
00053   Int_t plane;
00054   Int_t section;
00055   Int_t subsection;
00056   Int_t nstrips;
00057   Int_t nerrors;
00058   Double_t myX;
00059   Double_t myY;
00060   Double_t myZ[2];
00061   Double_t myTime[3];
00062   Double_t myCorrTime[3];
00063   Double_t myChargeNone[2];
00064   Double_t myChargePE[2];
00065   Double_t myGreenFibre[2];
00066   Double_t myWlsPigtail[2];
00067   Double_t myClearFibre[2];
00068   Double_t myHalfLength;
00069 
00070   for(i=0;i<3;i++){
00071     myTime[i] = 0.0;
00072     myCorrTime[i] = 0.0;
00073   }
00074 
00075   for(i=0;i<2;i++){
00076     myZ[i] = 0.0;
00077     myChargeNone[i] = 0.0;
00078     myChargePE[i] = 0.0;
00079     myGreenFibre[i] = 0.0;
00080     myWlsPigtail[i] = 0.0;
00081     myClearFibre[i] = 0.0;
00082   }
00083 
00084   myHalfLength = 0.0;
00085 
00086   for(i=0;i<1+myarray->GetLast();i++){
00087 
00088     CandDigitHandle* digit = (CandDigitHandle*)(myarray->At(i));
00089     const PlexSEIdAltL& pSEIdAltL =  digit->GetPlexSEIdAltL();
00090    
00091     if(!i){
00092      
00093       section=-1; subsection=-1;
00094       plane = pSEIdAltL.GetPlane();  
00095 
00096       if(plane>=528 && plane<=575){
00097         section=1;
00098         if(plane>=543 && plane<=557) subsection = 0;
00099         if(plane>=528 && plane<=542) subsection = 0;
00100         if(plane>=572 && plane<=575) subsection = 1;
00101         if(plane>=563 && plane<=566) subsection =-1;
00102         if(plane>=567 && plane<=568) subsection = 2;
00103         if(plane>=558 && plane<=559) subsection =-2;
00104       }
00105       if(plane>=592 && plane<=639){
00106         section=2;
00107         if(plane>=607 && plane<=621) subsection = 0; 
00108         if(plane>=592 && plane<=606) subsection = 0; 
00109         if(plane>=636 && plane<=639) subsection = 1;
00110         if(plane>=627 && plane<=630) subsection =-1;
00111         if(plane>=631 && plane<=632) subsection = 2;
00112         if(plane>=622 && plane<=623) subsection =-2;
00113       }
00114       if(plane>=656 && plane<=703){
00115         section=3;
00116         if(plane>=671 && plane<=685) subsection = 0;
00117         if(plane>=656 && plane<=670) subsection = 0;
00118         if(plane>=700 && plane<=703) subsection = 1;
00119         if(plane>=691 && plane<=694) subsection =-1;
00120         if(plane>=695 && plane<=696) subsection = 2;
00121         if(plane>=686 && plane<=687) subsection =-2;
00122       }
00123       if(plane>=720 && plane<=767){
00124         section=4;
00125         if(plane>=735 && plane<=749) subsection = 0;
00126         if(plane>=720 && plane<=734) subsection = 0;
00127         if(plane>=764 && plane<=797) subsection = 1;
00128         if(plane>=755 && plane<=758) subsection =-1;
00129         if(plane>=759 && plane<=760) subsection = 2;
00130         if(plane>=750 && plane<=751) subsection =-2;
00131       }
00132 
00133       nstrips=0; nerrors=0;
00134       myX=0.0; myY=0.0;
00135 
00136       for(PlexSEIdAltL::const_iterator iter = pSEIdAltL.begin(); iter != pSEIdAltL.end(); ++iter){
00137         PlexStripEndId pSEId( (*iter).GetSEId() );
00138         UgliStripHandle striphandle = ugh.GetStripHandle(pSEId);
00139         if(striphandle.IsValid()){
00140             
00141           TVector3 globalpos(striphandle.GlobalPos(0.0));
00142           halflength = striphandle.GetHalfLength();         
00143           myX+=globalpos.X(); myY+=globalpos.Y();
00144 
00145           myZ[0]+=globalpos.Z()+halflength;
00146           myGreenFibre[0]+=halflength;
00147           myWlsPigtail[0]+=striphandle.WlsPigtail(StripEnd::kNegative);
00148           myClearFibre[0]+=striphandle.ClearFiber(StripEnd::kNegative);
00149 
00150           myZ[1]+=globalpos.Z()-halflength;
00151           myGreenFibre[1]+=halflength;
00152           myWlsPigtail[1]+=striphandle.WlsPigtail(StripEnd::kPositive);
00153           myClearFibre[1]+=striphandle.ClearFiber(StripEnd::kPositive);
00154 
00155           myHalfLength=halflength;
00156 
00157           nstrips++; 
00158         }
00159         else{
00160           nerrors++;
00161         }
00162       }
00163      
00164       if( nstrips>0 ){
00165         myX=myX/(double)nstrips;
00166         myY=myY/(double)nstrips;
00167         
00168         for(j=0;j<2;j++){
00169           myZ[j]=myZ[j]/(double)nstrips;
00170           myGreenFibre[j]=myGreenFibre[j]/(double)nstrips;
00171           myWlsPigtail[j]=myWlsPigtail[j]/(double)nstrips;
00172           myClearFibre[j]=myClearFibre[j]/(double)nstrips;
00173         }
00174       }
00175 
00176       myplank.SetSection(section);
00177       myplank.SetSubSection(subsection);
00178       myplank.SetPlane(plane);
00179       myplank.SetNStrips(nstrips);
00180       myplank.SetGeomErrors(nerrors);
00181       myplank.SetX(myX);
00182       myplank.SetY(myY);
00183       myplank.SetZ(myZ);
00184     }
00185 
00186     if(pSEIdAltL.GetEnd()==StripEnd::kNegative){
00187       myTime[0] = digit->GetSubtractedTime(CalTimeType::kNone);
00188       myCorrTime[0] = myTime[0] - (indx/3.0e8)*(myWlsPigtail[0]+myClearFibre[0]);
00189       myChargeNone[0] = digit->GetCharge(CalDigitType::kNone);
00190       myChargePE[0]= digit->GetCharge(CalDigitType::kPE);
00191       if( myChargeNone[0]>0.0 && myChargePE[0]/myChargeNone[0]>0.1 ){
00192         MSG("FarDetShieldPlank",Msg::kVerbose) << " uncalibrated shield charge: "
00193                                             << " ADC=" << myChargeNone[0] << " PE=" << myChargePE[0] << endl
00194                                             << "  ... using empirical calibration of 90 ADC/PE " << endl;
00195         myChargePE[0]=myChargeNone[0]/90.0; 
00196       }
00197     }
00198 
00199     if(pSEIdAltL.GetEnd()==StripEnd::kPositive){
00200       myTime[1] = digit->GetSubtractedTime(CalTimeType::kNone);
00201       myCorrTime[1] = myTime[1] - (indx/3.0e8)*(myWlsPigtail[1]+myClearFibre[1]);
00202       myChargeNone[1] = digit->GetCharge(CalDigitType::kNone);
00203       myChargePE[1]= digit->GetCharge(CalDigitType::kPE);
00204       if( myChargeNone[1]>0.0 && myChargePE[1]/myChargeNone[1]>0.1 ){
00205         MSG("FarDetShieldPlank",Msg::kVerbose) << " uncalibrated shield charge: "
00206                                             << " ADC=" << myChargeNone[1] << " PE=" << myChargePE[1] << endl
00207                                             << "  ... using empirical calibration of 90 ADC/PE " << endl;
00208         myChargePE[1]=myChargeNone[1]/90.0; 
00209       }
00210     }
00211 
00212     myplank.AddDaughterLink(*digit);
00213   }
00214 
00215   Double_t Sqct=0.0,Sqt=0.0,Sq=0.0;
00216   for(i=0;i<2;i++){
00217     Sqct+=myCorrTime[i]*myChargePE[i];
00218     Sqt+=myTime[i]*myChargePE[i];
00219     Sq+=myChargePE[i];
00220   }
00221   if(Sq>0.0){
00222     myCorrTime[2]=Sqct/Sq;
00223     myTime[2]=Sqt/Sq;
00224   }
00225 
00226   myplank.SetTime(myTime);
00227   myplank.SetCorrectedTime(myCorrTime);
00228 
00229   myplank.SetCharge(CalDigitType::kNone,myChargeNone);
00230   myplank.SetCharge(CalDigitType::kPE,myChargePE);
00231 
00232   myplank.SetFibreLengths(myGreenFibre,myWlsPigtail,myClearFibre,myHalfLength);
00233 
00234   MSG("FarDetShieldPlank",Msg::kDebug) << " SHIELDPLANK : "
00235                                        << " (" << myplank.GetNDaughters() << ")" 
00236                                        << " " << myplank.GetSection()
00237                                        << " " << myplank.GetSubSection()
00238                                        << " " << myplank.GetPlane()
00239                                        << " " << myplank.GetCharge()
00240                                        << " " << 1.0e9*myplank.GetTime() << endl;  
00241  
00242 }

void AlgFarDetShieldPlank::Trace const char *  c  )  const [virtual]
 

Reimplemented from AlgBase.

Definition at line 244 of file AlgFarDetShieldPlank.cxx.

00245 {
00246 
00247 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 1 15:55:24 2007 for loon by  doxygen 1.3.9.1