#include "Validity/VldTimeStamp.h"Go to the source code of this file.
Functions | |
| float | calc_acor (float lc, float lg, float c1=0.3333, float c2=0.6667, float l1=1.052, float l2=7.078, float l3=11.4) |
| void | load_mc_mipcal (float scale) |
| void | load_better_mipcal (float scale, VldTimeStamp vtm) |
|
||||||||||||||||||||||||||||||||
|
Definition at line 20 of file BetterMCTables.cxx. Referenced by load_better_mipcal(). 00020 {
00021
00022 float a=(1.0/(c1+c2))*(c1*std::exp(-lg/l1) + c2*std::exp(-lg/l2));
00023 float b=std::exp(-lc/l3);
00024 return (a*b);
00025 }
|
|
||||||||||||
|
Definition at line 90 of file BetterMCTables.cxx. References PlexStripEndId::BuildPlnStripEndKey(), calc_acor(), DbiWriter< T >::CanOutput(), UgliStripHandle::ClearFiber(), DbiWriter< T >::Close(), DbiCascader::CreateTemporaryTable(), DbiTableProxyRegistry::GetCascader(), PlexStripEndId::GetEnd(), UgliStripHandle::GetHalfLength(), Calibrator::GetPhotoElectrons(), UgliGeomHandle::GetStripHandle(), Calibrator::Instance(), DbiTableProxyRegistry::Instance(), UgliStripHandle::IsValid(), CalScheme::Reset(), and UgliStripHandle::WlsPigtail(). 00090 {
00091
00092 // fake up a mipcal table for mc
00093
00094 // Ask the singleton DbiTableProxyRegistry for the DbiCascader.
00095 DbiCascader& cascader=DbiTableProxyRegistry::Instance().GetCascader();
00096
00097 // Define the table.
00098 string tableDescr ="(SEQNO int, SEIDKEY int, STRIPENDID int, SCALE float)";
00099 // Ask the cascader to find a database that will accept it.
00100 Int_t dbNoTemp = cascader.CreateTemporaryTable("CALMIPCALIBRATION",tableDescr);
00101
00102 if (dbNoTemp<0){
00103 cout << "No database to will accept temporary tables. " << endl;
00104 return;
00105 }
00106 else{
00107 cout<<"Database number "<<dbNoTemp<<endl;
00108 }
00109
00110 VldTimeStamp vts(2001,1,1,0,0,0);
00111 VldTimeStamp vte(2010,1,1,0,0,0);
00112
00113
00114 VldRange vr(Detector::kCalDet,SimFlag::kMC,vts,vte,"by hand");
00115 VldTimeStamp create;
00116
00117 DbiWriter<CalMIPCalibration> tcal(vr, -1, 0, create);
00118
00119 // the time that the mc run corresponds to
00120 VldContext vcm(Detector::kCalDet, SimFlag::kMC, vtm);
00121
00122 cout<<"better_mc_tables! \nstart: "<<vts
00123 <<"\nend: "<<vte
00124 <<"\n vtm: "<<vtm
00125 <<"\ncontext: "<<vcm<<endl;
00126
00127 // we will need some geometry information to calculate attenuations
00128 UgliGeomHandle ugh(vcm);
00129
00130 // get a digit calibrator
00131 // we will use it to account for gains
00132 Calibrator::Instance().Reset(vcm);
00133 const float about_1pe=60;
00134
00135 // cout<<"Starting to loop over planes and strips"<<endl;
00136 for(int plane=0;plane<60;plane++){
00137 for(int strip=0;strip<24;strip++){
00138 PlexStripEndId seidn(Detector::kCalDet,plane,strip,
00139 StripEnd::kNegative);
00140 PlexStripEndId seidp(Detector::kCalDet,plane,strip,
00141 StripEnd::kPositive);
00142 const Int_t seidkeyn = seidn.BuildPlnStripEndKey();
00143 const Int_t seidkeyp = seidp.BuildPlnStripEndKey();
00144 UgliStripHandle ugs_n = ugh.GetStripHandle(seidn);
00145 UgliStripHandle ugs_p = ugh.GetStripHandle(seidp);
00146 // cout<<plane<<" "<<strip<<endl;
00147 const bool nvalid = ugs_n.IsValid();
00148 const bool pvalid = ugs_p.IsValid();
00149 if(!nvalid) cout<<"neg not valid!"<<endl;
00150 if(!pvalid) cout<<"pos not valid!"<<endl;
00151 if(!(pvalid & nvalid)) continue;
00152
00153 const float clear_n = ugs_n.ClearFiber(seidn.GetEnd());
00154 const float green_n = ugs_n.GetHalfLength()
00155 +ugs_n.WlsPigtail(seidn.GetEnd());
00156
00157 const float clear_p = ugs_p.ClearFiber(seidp.GetEnd());
00158 const float green_p = ugs_p.GetHalfLength()
00159 +ugs_p.WlsPigtail(seidp.GetEnd());
00160 // fiber attenuations from mid strip to phototube
00161
00162 float calc_acor(float lc, float lg, float c1=0.3333, float c2=0.6667,
00163 float l1=1.052, float l2=7.078, float l3=11.4);
00164
00165
00166 const float an = calc_acor(clear_n, green_n,
00167 0.3333, 0.6667, 1.052, 7.078, 11.4);
00168 const float ap = calc_acor(clear_p, green_p,
00169 0.3333, 0.6667, 1.052, 7.078, 11.4);
00170 // channel gain
00171 // cout<<"here"<<endl;
00172 // cout<<dc.GetPhotoElectrons(about_1pe,seidn)<<endl;
00173 // cout<<dc.GetPhotoElectrons(about_1pe,seidp)<<endl;
00174 const float gn = about_1pe/(Calibrator::Instance().GetPhotoElectrons(about_1pe,seidn));
00175 const float gp = about_1pe/(Calibrator::Instance().GetPhotoElectrons(about_1pe,seidp));
00176 // normalization for attenuation
00177 // calculate the average (of both sides) attenuation
00178 // for a central strip with 4.65m green on one side
00179 // and 6m clear on the other with 0.65 green
00180 // this is just a convention but it corresponds to what we
00181 // usually are looking at for beam particles in 2002
00182 // scale then is average pe/mip for central strips
00183 const float norm=(calc_acor(0, 4.65)+calc_acor(6,0.65))/2.0;
00184 // constants
00185 const float sn=scale*gn*an/norm;
00186 const float sp=scale*gp*ap/norm;
00187
00188 cout<<plane<<" "<<strip<<" "<<sn<<" "<<sp<<endl;
00189
00190 // eventual table values are ~ sigcor/mip
00191 CalMIPCalibration tcn(seidkeyn, StripEnd::kNegative,sn);
00192 tcal<<tcn;
00193 CalMIPCalibration tcp(seidkeyp, StripEnd::kPositive,sp);
00194 tcal<<tcp;
00195 }
00196 }
00197 if(!tcal.CanOutput()){
00198 cout<<"MakeTimeCal: Writer can't output!"<<endl;
00199 }
00200
00201 cout<<"Done."<<endl;
00202 tcal.Close();
00203 cout<<"vtm: "<<vtm<<endl;
00204 }
|
|
|
Definition at line 27 of file BetterMCTables.cxx. References PlexStripEndId::BuildPlnStripEndKey(), DbiWriter< T >::CanOutput(), DbiWriter< T >::Close(), DbiCascader::CreateTemporaryTable(), DbiTableProxyRegistry::GetCascader(), and DbiTableProxyRegistry::Instance(). 00027 {
00028
00029 // fake up a mipcal table for mc
00030
00031 // Ask the singleton DbiTableProxyRegistry for the DbiCascader.
00032 DbiCascader& cascader=DbiTableProxyRegistry::Instance().GetCascader();
00033
00034 // Define the table.
00035 string tableDescr ="(SEQNO int, SEIDKEY int, STRIPENDID int, SCALE float)";
00036 // Ask the cascader to find a database that will accept it.
00037 Int_t dbNoTemp = cascader.CreateTemporaryTable("CALMIPCALIBRATION",tableDescr);
00038
00039 if (dbNoTemp<0){
00040 cout << "No database to will accept temporary tables. " << endl;
00041 return;
00042 }
00043 else{
00044 cout<<"Database number "<<dbNoTemp<<endl;
00045 }
00046 VldTimeStamp vts(2001,1,1,0,0,0);
00047 VldTimeStamp vte(2010,1,1,0,0,0);
00048
00049 VldRange vr(Detector::kCalDet,SimFlag::kMC,vts,vte,"by hand");
00050 VldTimeStamp create;
00051 /*
00052 cout<<"Validity time stamp create: "<<endl;
00053 create.Print();
00054 cout<<endl;
00055 cout<<"Validity time stamp start: "<<endl;
00056 vts.Print();
00057 cout<<endl;
00058 cout<<"Validity time stamp end: "<<endl;
00059 vte.Print();
00060 cout<<endl;
00061 */
00062
00063 DbiWriter<CalMIPCalibration> tcal(vr, -1, 0, create);
00064
00065 // cout<<"Starting to loop over planes and strips"<<endl;
00066 for(int plane=0;plane<60;plane++){
00067 for(int strip=0;strip<24;strip++){
00068 PlexStripEndId seidn(Detector::kCalDet,plane,strip,
00069 StripEnd::kNegative);
00070 PlexStripEndId seidp(Detector::kCalDet,plane,strip,
00071 StripEnd::kPositive);
00072 Int_t seidkeyn = seidn.BuildPlnStripEndKey();
00073 Int_t seidkeyp = seidp.BuildPlnStripEndKey();
00074 CalMIPCalibration tcn(seidkeyn, StripEnd::kNegative,scale);
00075 tcal<<tcn;
00076 CalMIPCalibration tcp(seidkeyp, StripEnd::kPositive,scale);
00077 tcal<<tcp;
00078 }
00079 }
00080 if(!tcal.CanOutput()){
00081 cout<<"MakeTimeCal: Writer can't output!"<<endl;
00082 }
00083
00084 cout<<"Done."<<endl;
00085 tcal.Close();
00086
00087 }
|
1.3.9.1