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

AttenCorr.cxx

Go to the documentation of this file.
00001 // 
00002 // October 9 2007
00003 //
00004 // Author: Pedro O. and Mark T. 
00005 // 
00006 // Calculates attenuation corrections for strips
00007 
00008 #include <iostream>
00009 #include <cmath>
00010 #include "TMath.h"
00011 #include "TClonesArray.h"
00012 #include "AttenCorr.h"
00013 #include "StandardNtuple/NtpStRecord.h"
00014 #include "CandNtupleSR/NtpSRStrip.h"
00015 #include "UgliGeometry/UgliGeomHandle.h"
00016 
00017 using std::cout;
00018 using std::endl;
00019 
00020 static const float  MEAN_ATTEN = 0.326; //mean attenuation correction of near and far dets
00021 static const float  ND_CORRECTION = 1.;
00022 static const float  REFLECTIVITY = 0.8;
00023 
00024 AttenCorr::AttenCorr()
00025 {  
00026   Reset();
00027 }
00028 
00029 AttenCorr::~AttenCorr()
00030 {
00031 }
00032 
00033 // ***************** METHODS ***********************
00034 
00035 void AttenCorr::Reset(){
00036 
00037   qpeE=-100;
00038   qpeW=-100;
00039   lE=-1;
00040   lW=-1;
00041   halflength=-1;
00042   wlspigtail_w=-1;
00043   wlspigtail_e=-1;
00044   clearfiber_w=-1;
00045   clearfiber_e=-1;
00046   centeru=-1;
00047   centerv=-1;
00048   qpeWcor=-100;
00049   qpeEcor=-100;;
00050   attenE=-1;
00051   attenW=-1;
00052 
00053 }
00054 
00055 // -----------------------------------------------------
00056 void AttenCorr::Setup(const NtpStRecord* record,const NtpSRStrip* strip,unsigned short qtype){
00057 
00058   Reset();
00059 
00060   //Geometry handles and such
00061   UgliGeomHandle ugh(record->GetHeader().GetVldContext()); 
00062   detector = record->GetHeader().GetVldContext().GetDetector();  
00063   PlexStripEndId pseid(record->GetHeader().GetVldContext().GetDetector()
00064                        ,strip->plane, strip->strip);
00065   UgliStripHandle stripgeom(ugh.GetStripHandle(pseid));
00066 
00067   //Necessary quantities
00068   if (qtype == 0) {
00069     qpeE=strip->ph0.pe;
00070     qpeW=strip->ph1.pe;
00071   }
00072   if (qtype == 5) {
00073     qpeE = strip->ph0.sigcor;
00074     qpeW = strip->ph1.sigcor;
00075   }
00076   halflength = stripgeom.GetHalfLength();
00077   wlspigtail_w = stripgeom.WlsPigtail(StripEnd::kWest);
00078   wlspigtail_e = stripgeom.WlsPigtail(StripEnd::kEast);
00079   clearfiber_w = stripgeom.ClearFiber(StripEnd::kWest);
00080   clearfiber_e = stripgeom.ClearFiber(StripEnd::kEast);
00081   const TVector3 globalpos(stripgeom.GlobalPos(0));
00082   centerv = .7071067812*(globalpos.Y()-globalpos.X());
00083   centeru = .7071067812*(globalpos.Y()+globalpos.X());
00084 
00085   /*cout << "The wlspigtails " << endl;//<--tmp
00086   cout << wlspigtail_w << "," << wlspigtail_e << endl;
00087   cout << "The clearfibers " << endl;
00088   cout << clearfiber_w << "," << clearfiber_e << endl;
00089   cout << "The centeru and centerv " << endl;
00090   cout << centeru << "," << centerv << endl;*/
00091 
00092 }
00093 
00094 // --------------------------------------------------
00095 void AttenCorr::CalcPECorr(const int){
00096 
00097   float lwlsE = 0;
00098   float lwlsW = 0;
00099   float fE = 0;
00100   float fW = 0;
00101 
00102   if(detector==0x02 || detector==0x04){//<-- Far Detector OR Caldet
00103 
00104     lwlsE = wlspigtail_e + lE;
00105     lwlsW = wlspigtail_w + lW;
00106     fE = 1./( 0.666*exp(-lwlsE/7.05)+ 0.333*exp(-lwlsE/1.05));
00107     fW = 1./( 0.666*exp(-lwlsW/7.05)+ 0.333*exp(-lwlsW/1.05));
00108     fE = fE*exp(+(clearfiber_e/10.));
00109     fW = fW*exp(+(clearfiber_w/10.));
00110     qpeEcor = qpeE*fE*MEAN_ATTEN;
00111     qpeWcor = qpeW*fW*MEAN_ATTEN;
00112     qpecor = (qpeEcor+qpeWcor)*ND_CORRECTION;  
00113 
00114     attenE=fE;
00115     attenW=fW;
00116     
00117   } else if(detector==0x01){//<--Near Detector (only W readout; reflection in E)
00118 
00119     lwlsW = wlspigtail_w + lW;
00120     lwlsE = 4*halflength - fabs(lW) + wlspigtail_w;
00121       
00122     fW = 1.*(0.666*exp(-lwlsW/7.05)+ 0.333*exp(-lwlsW/1.05));//Caution: it's not 1/fW as in FarDet; same for fE below;
00123 
00124     //A la Pedro
00125     fE = 1.*(0.666*exp(-lwlsE/7.05)+ 0.333*exp(-lwlsE/1.05))*REFLECTIVITY;
00126     float fCor = 2./((fE+fW)*exp(-clearfiber_w/10.));
00127     fCor=fCor*1.587;//determined from muons, on Nov-23-2007, for cedar_phy
00128     
00129     //A la Caius
00130     //float fCor = 1./(fW*exp(-clearfiber_w/10.));//<--tmp
00131     //fCor=fCor*1.9454;
00132 
00133     qpeWcor = qpeW*fCor*MEAN_ATTEN;
00134     qpecor = qpeWcor*ND_CORRECTION;
00135        
00136     attenE=0;
00137     attenW=fCor;
00138     
00139   }
00140 
00141 
00142 }
00143 
00144 
00145 //---------------------------------------------------
00146 void AttenCorr::CalcCorr(const NtpStRecord* record,const NtpSRStrip* strip,Float_t meanUTPos, Float_t meanVTPos, unsigned short qtype){
00147 
00148   Setup(record,strip,qtype);
00149 
00150   if(strip->planeview==2){ //U view
00151     //location in V of E end:
00152     lE = centerv + halflength - meanVTPos; 
00153     lW = meanVTPos - (centerv - halflength);
00154   }else{  //V view
00155     lE = meanUTPos - (centeru - halflength);
00156     lW = centeru+halflength -meanUTPos;
00157   }
00158 
00159   //cout << "The lE, lW and halflength " << endl;//<--tmp
00160   //cout << lE << "," << lW << "," << halflength << endl;
00161 
00162   CalcPECorr(detector);
00163 
00164   //MHO0509
00165   //cout << "MHO - AttenCorr found attenE*MEAN_ATTEN " << attenE*MEAN_ATTEN << " and attenW*MEAN_ATTEN " << attenW*MEAN_ATTEN << " in strip " << strip->strip << " and plane " << strip->plane << endl;
00166   
00167 }

Generated on Mon Feb 15 11:06:23 2010 for loon by  doxygen 1.3.9.1