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

Private Attributes

ShieldGeomfShieldGeom

Detailed Description

Definition at line 9 of file AlgFarDetShieldPlank.h.


Constructor & Destructor Documentation

AlgFarDetShieldPlank::AlgFarDetShieldPlank (  ) 

Definition at line 26 of file AlgFarDetShieldPlank.cxx.

References Msg::kVerbose, and MSG.

00026                                            :
00027  fShieldGeom(0)
00028 {
00029   MSG("FarDetShieldPlank",Msg::kVerbose) << " *** AlgFarDetShieldPlank::AlgFarDetShieldPlank() *** " << endl;
00030 
00031 }

AlgFarDetShieldPlank::~AlgFarDetShieldPlank (  )  [virtual]

Definition at line 33 of file AlgFarDetShieldPlank.cxx.

References fShieldGeom, Msg::kVerbose, and MSG.

00034 {
00035   MSG("FarDetShieldPlank",Msg::kVerbose) << " *** AlgFarDetShieldPlank::~AlgFarDetShieldPlank() *** " << endl;
00036  
00037   if( fShieldGeom ) delete fShieldGeom;
00038 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 40 of file AlgFarDetShieldPlank.cxx.

References CandHandle::AddDaughterLink(), digit(), fShieldGeom, ShieldGeom::GetAssociatedPlank(), CandContext::GetCandRecord(), CandDigitHandle::GetCharge(), FarDetShieldPlankHandle::GetCharge(), CandContext::GetDataIn(), PlexSEIdAltL::GetEnd(), UgliStripHandle::GetHalfLength(), CandHandle::GetNDaughters(), PlexSEIdAltL::GetPlane(), PlexPlaneId::GetPlane(), FarDetShieldPlankHandle::GetPlane(), ShieldGeom::GetPlank_X(), ShieldGeom::GetPlank_Y(), CandDigitHandle::GetPlexSEIdAltL(), FarDetShieldPlankHandle::GetSection(), PlexStripEndId::GetStrip(), UgliGeomHandle::GetStripHandle(), FarDetShieldPlankHandle::GetSubSection(), CandDigitHandle::GetSubtractedTime(), FarDetShieldPlankHandle::GetTime(), RecMinos::GetVldContext(), Msg::kDebug, StripEnd::kNegative, CalTimeType::kNone, CalDigitType::kNone, CalDigitType::kPE, StripEnd::kPositive, CalTimeType::kT0, Msg::kVerbose, MSG, ShieldGeom::Reinitialize(), PlexVetoShieldHack::RenumberMuxToMdl(), FarDetShieldPlankHandle::SetCharge(), FarDetShieldPlankHandle::SetFibreLengths(), FarDetShieldPlankHandle::SetGeomErrors(), FarDetShieldPlankHandle::SetNStrips(), FarDetShieldPlankHandle::SetPlane(), FarDetShieldPlankHandle::SetPlank(), FarDetShieldPlankHandle::SetSection(), FarDetShieldPlankHandle::SetSubSection(), FarDetShieldPlankHandle::SetTime(), FarDetShieldPlankHandle::SetX(), FarDetShieldPlankHandle::SetY(), and FarDetShieldPlankHandle::SetZ().

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

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

Reimplemented from AlgBase.

Definition at line 264 of file AlgFarDetShieldPlank.cxx.

00265 {
00266 
00267 }


Member Data Documentation

Definition at line 20 of file AlgFarDetShieldPlank.h.

Referenced by RunAlg(), and ~AlgFarDetShieldPlank().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1