AlgSubShowerSR.cxx File Reference

#include <cassert>
#include <vector>
#include "Algorithm/AlgConfig.h"
#include "Candidate/CandContext.h"
#include "Conventions/PlaneView.h"
#include "MessageService/MsgService.h"
#include "Validity/VldContext.h"
#include "Calibrator/Calibrator.h"
#include "CandSubShowerSR/AlgSubShowerSR.h"
#include "CandSubShowerSR/CandSubShowerSRHandle.h"
#include "CandSubShowerSR/ClusterType.h"
#include "CandSubShowerSR/EMFluctuation.h"
#include "CandFitShowerEM/BinFluctuationEM.h"
#include "RecoBase/CandStripHandle.h"
#include "TMath.h"
#include "TMatrixD.h"
#include "TVectorD.h"
#include "TVector2.h"
#include "TMatrixDSym.h"
#include "TMatrixDSymEigen.h"
#include "TCanvas.h"
#include "TStyle.h"

Go to the source code of this file.

Defines

#define D_EFF   6.0
#define T_EFF   4.0
#define EC_EFF   21.6297
#define X0_EFF   4.1542
#define RM_EFF   4.0717
#define ST_WID   4.1

Functions

Double_t LongShwProfSamAng (double *, double *)
Double_t TranShwProfSamAng (double *, double *)
Double_t LongShwProfSamn (double *, double *)
Double_t TranShwProfSamn (double *, double *)
Bool_t SortStripByEnergy (Double_t *, Int_t, Int_t *)
Double_t StpFluctuaionAng (double *, double *)
Double_t Chi2 (double *, double *)
 CVSID ("$Id: AlgSubShowerSR.cxx,v 1.20 2006/08/10 11:35:30 cbs Exp $")

Define Documentation

#define D_EFF   6.0

Definition at line 33 of file AlgSubShowerSR.cxx.

#define EC_EFF   21.6297
#define RM_EFF   4.0717

Definition at line 37 of file AlgSubShowerSR.cxx.

#define ST_WID   4.1

Definition at line 38 of file AlgSubShowerSR.cxx.

#define T_EFF   4.0
#define X0_EFF   4.1542

Definition at line 36 of file AlgSubShowerSR.cxx.


Function Documentation

Double_t Chi2 ( double *  x,
double *  par 
)

Definition at line 1401 of file AlgSubShowerSR.cxx.

Referenced by AlgSubShowerSR::AlgSubShowerSR(), FitterEM::CalculateChi2(), FitterEM::DoFit(), Anp::SelectAntiNeutrino::Run1(), Anp::SelectAntiNeutrino::Run2(), AlgFitTrackCam::SetTrackProperties(), and AlgFitTrackCam::TimingFit().

01401                                     {
01402 
01403   return TMath::Exp(-x[0]/2.)*TMath::Power(x[0],par[0]/2. - 1)/(TMath::Power(2.,par[0]/2.)*TMath::Gamma(par[0]/2.));
01404 
01405 }

CVSID ( "$Id: AlgSubShowerSR.  cxx,
v 1.20 2006/08/10 11:35:30 cbs Exp $"   
)
Double_t LongShwProfSamAng ( double *  x,
double *  par 
)

Definition at line 1198 of file AlgSubShowerSR.cxx.

References D_EFF, EC_EFF, Msg::kVerbose, LongShwProfSamn(), MSG, RM_EFF, T_EFF, and X0_EFF.

Referenced by AlgSubShowerSR::AlgSubShowerSR().

01198                                                  {
01199   Double_t plz = x[0];
01200   Double_t E = par[0]*1000; //Energy in MeV
01201   if(E<=0.) return 0;
01202   Double_t tmax = log(E/EC_EFF)-0.858;
01203   Double_t theta = par[1];
01204   Double_t theta_rt = TMath::ATan(TMath::Tan(theta)*(T_EFF*X0_EFF)/(D_EFF*RM_EFF));
01205   Double_t delta_z = 0.1*D_EFF;
01206   if(plz/X0_EFF/cos(theta_rt)>2*tmax) delta_z = 0.2*D_EFF;
01207   Double_t z = (plz-D_EFF/2.)/X0_EFF;
01208   Double_t dE = 0.;
01209   for(Int_t i=0;i<=int(D_EFF/delta_z);i++){
01210     Double_t t[1] = {0.};
01211     if (cos(theta_rt)!=0.) t[0] = z/cos(theta_rt);
01212     if(t[0]>0.01*delta_z/X0_EFF)
01213       dE += LongShwProfSamn(t,par)*cos(theta)*delta_z;
01214     MSG("SubShowerSR",Msg::kVerbose)<<"z "<<z<<" t[0] "<<t[0]<<" dE "<<dE<<endl;
01215     z+=delta_z/X0_EFF;
01216   }
01217   return dE;
01218 }

Double_t LongShwProfSamn ( double *  x,
double *  par 
)

Definition at line 1266 of file AlgSubShowerSR.cxx.

References Msg::kVerbose, MSG, and MinosMaterial::Z().

Referenced by LongShwProfSamAng().

01266                                                {
01267 
01268   Double_t t = x[0];
01269   Double_t E = par[0]*1000.; //Energy in MeV
01270   if(E<=0.||t<=0.) return 0;
01271   Double_t Z = 24.9814;
01272   Double_t Ec = 20.7941;
01273   Double_t Fs = 0.692366;
01274   Double_t ehat = 0.8752;
01275   
01276   Double_t lny = TMath::Log(E/Ec);
01277   Double_t alpha = 0.21 + (0.492+2.38/Z)*lny;
01278   Double_t T = lny - 0.858;
01279 
01280   T = T - 0.59/Fs - 0.53*(1-ehat);
01281   alpha = alpha - 0.444/Fs;
01282 
01283   Double_t belta  = (alpha-1)/T;
01284   if(belta<=0.||alpha<=0) return 0.;
01285   Double_t f = TMath::Power((belta*t),(alpha-1))
01286     *belta*TMath::Exp(-(belta*t))/TMath::Gamma(alpha);
01287   MSG("SubShowerSR",Msg::kVerbose)<<"belta "<<belta<<" t "<<t<<" alpha "<<alpha<<" "<<TMath::Gamma(alpha)<<" "<<f<<endl;
01288   return f;
01289 
01290 }

Bool_t SortStripByEnergy ( Double_t *  eng0,
Int_t  nstp,
Int_t *  sort 
)

Definition at line 1349 of file AlgSubShowerSR.cxx.

References Msg::kVerbose, and MSG.

01349                                                                {
01350   std::vector<Double_t> eng(nstp,0);
01351   for (Int_t i=0; i<=nstp-1; i++) {
01352     sort[i] = -1;
01353     eng[i] = 0.;
01354   }
01355   for (Int_t i=0; i<=nstp-1; i++) {
01356     Int_t j = 0;
01357     while(eng0[i]<=eng[j]){
01358       j++;
01359     }
01360     MSG("SubShowerSR",Msg::kVerbose)<< "i " << i << " " << eng0[i]
01361                                     << " j " << j << " " << eng[j] << endl;
01362     if(eng[j]>0){
01363       Int_t k = nstp-j;
01364       while(k>0){
01365         if(eng[j+k-1]>0){
01366           eng[j+k] = eng[j+k-1];
01367           sort[j+k] = sort[j+k-1];
01368         }
01369         k--;
01370       }
01371     }
01372     eng[j] = eng0[i];
01373     sort[j] = i;
01374   }
01375   return true;
01376 }

Double_t StpFluctuaionAng ( double *  x,
double *  par 
)

Definition at line 1379 of file AlgSubShowerSR.cxx.

References BinFluctuationEM::CalcFluctuation(), D_EFF, Msg::kVerbose, MSG, and T_EFF.

01379                                                 {
01380   Double_t plz = x[0];
01381   Double_t z = plz;
01382   Double_t stptpos = x[1];
01383   Double_t tpos = stptpos;
01384   Double_t E = par[0]*1000; //Energy in MeV
01385   if(E<=0) return 0;
01386   Double_t theta = par[1];
01387   //  Double_t theta_rt = TMath::ATan(TMath::Tan(theta)*(T_EFF*X0_EFF)/(D_EFF*RM_EFF));
01388   BinFluctuationEM fluEM = BinFluctuationEM(par[0]);
01389   Double_t rt[2] = {0.,0.};
01390   rt[1] = TMath::Abs(tpos*cos(theta)*100./T_EFF);
01391   if (cos(theta)!=0.) rt[0] = (z/cos(theta)+tpos*sin(theta))*100./D_EFF;
01392   else {
01393     rt[0] = tpos*sin(theta)*100./D_EFF;
01394   }
01395   if(rt[0]<0.) rt[0] = 0.;
01396   MSG("SubShowerSR",Msg::kVerbose)<<"t r "<<plz<<" "<<stptpos<<" "<<theta<<" "<<rt[0]<<" "<<rt[1]<<endl;
01397   return fluEM.CalcFluctuation(rt[0],rt[1]);
01398 }

Double_t TranShwProfSamAng ( double *  x,
double *  par 
)

Definition at line 1221 of file AlgSubShowerSR.cxx.

References D_EFF, MuELoss::e, EC_EFF, Msg::kVerbose, MSG, RM_EFF, T_EFF, TranShwProfSamn(), and X0_EFF.

Referenced by AlgSubShowerSR::AlgSubShowerSR().

01221                                                  {
01222 
01223   Double_t stptpos = x[0];
01224   Double_t E = par[0]*1000; //Energy in MeV
01225   if(E<=0) return 0;
01226   Double_t tmax = log(E/EC_EFF)-0.858;
01227   MSG("SubShowerSR",Msg::kVerbose)<<"E "<<E<<" tmax "<<tmax<<endl;
01228   Double_t theta = par[1];
01229   Double_t theta_rt = TMath::ATan(TMath::Tan(theta)*(T_EFF*X0_EFF)/(D_EFF*RM_EFF));
01230   Double_t delta_z = 0.25*D_EFF;
01231   Double_t delta_tpos = 0.1*T_EFF;
01232   if(TMath::Abs(stptpos/RM_EFF*cos(theta_rt))>1.) delta_tpos = 0.2*T_EFF;
01233   Double_t z = 0;
01234   Double_t tpos = (stptpos-T_EFF/2.)/RM_EFF;
01235   Double_t dE = 0.;
01236   Double_t cutoff = 1e-3;
01237   for(Int_t i=0;i<=int(T_EFF/delta_tpos);i++){
01238     Double_t rt[2] = {0.,0.};
01239     rt[1] = tpos*cos(theta_rt);
01240     Double_t allplE = 0.;
01241     Bool_t keepgoing = true;
01242     z = 0.;
01243     MSG("SubShowerSR",Msg::kVerbose)<<"rt[1] "<<rt[1]<<" "<<theta_rt<<endl;
01244     while(keepgoing){
01245       if (cos(theta_rt)!=0.) rt[0] = z/cos(theta_rt)+tpos*sin(theta_rt);
01246       else {
01247         rt[0] = tpos*sin(theta_rt);
01248         keepgoing = false;
01249       }
01250       MSG("SubShowerSR",Msg::kVerbose)<<"rt[0] "<<rt[0]<<endl;
01251       Double_t fracE = 0.;
01252       //      if(rt[0]>=0)
01253       fracE = TranShwProfSamn(rt,par);
01254       allplE += fracE*cos(theta)*delta_tpos*delta_z;
01255       if(fracE<cutoff||z<0.||z>1.5*tmax) keepgoing = false;
01256       if(z>1.25*tmax) delta_z = 0.5*D_EFF;
01257       z+=delta_z/X0_EFF;
01258     }
01259     dE += allplE;
01260     tpos+=delta_tpos/RM_EFF;
01261   }
01262   return dE;
01263 }

Double_t TranShwProfSamn ( double *  x,
double *  par 
)

Definition at line 1293 of file AlgSubShowerSR.cxx.

References Msg::kVerbose, MSG, and MinosMaterial::Z().

Referenced by TranShwProfSamAng().

01293                                                 {
01294 
01295   Double_t t = x[0];
01296   Double_t r = TMath::Abs(x[1]);
01297   Double_t E = par[0]*1000.; //Energy in MeV
01298   if(E<=0) return 0;
01299   MSG("SubShowerSR",Msg::kVerbose)<<"rte "<<t<<" "<<r<<" "<<E<<endl;
01300   Double_t Z = 24.9814;
01301   Double_t Ec = 21.6297;
01302   Double_t Fs = 0.692366;
01303   Double_t ehat = 0.8752;
01304   
01305   Double_t lny = log(E/Ec);
01306   Double_t T = lny - 0.858;
01307   T = T - 0.59/Fs - 0.53*(1-ehat);
01308   if(T<=0||t/T>100.) return 0;
01309   MSG("SubShowerSR",Msg::kVerbose)<<"T "<<T<<endl;
01310   Double_t tau = t/T;
01311 
01312   Double_t z1 = 0.0251+0.00319*log(E);
01313   Double_t z2 = 0.1162+(-0.000381*Z);
01314 
01315   Double_t k1 = 0.659+(-0.00309*Z);
01316   Double_t k2 = 0.645;
01317   Double_t k3 = -2.59;
01318   Double_t k4 = 0.3585+0.0421*log(E);
01319 
01320   Double_t p1 = 2.632+(-0.00094*Z);
01321   Double_t p2 = 0.401+0.00187*Z;
01322   Double_t p3 = 1.313+(-0.0686*log(E));
01323   if(tau-k2<-1.) return 0;
01324   MSG("SubShowerSR",Msg::kVerbose)<<"k "<<k1<<" "<<k2<<" "<<k3<<" "<<k4<<endl;
01325   Double_t Rc = z1+z2*tau;
01326   Double_t Rt = k1*(exp(k3*(tau-k2))+exp(k4*(tau-k2)));
01327   Double_t p = p1*exp((p2-tau)/p3-exp((p2-tau)/p3));
01328   MSG("SubShowerSR",Msg::kVerbose)<<"Rt0 "<<Rt<<endl;
01329   MSG("SubShowerSR",Msg::kVerbose)<<ehat<<" "<<Fs<<" "<<tau<<endl;
01330   Rc = Rc - 0.0203*(1.-ehat)+(0.0397/Fs)*exp(-tau);
01331   MSG("SubShowerSR",Msg::kVerbose)<<"Rc "<<Rc<<endl;
01332   Rt = Rt - 0.14*(1-ehat)-(0.495/Fs)*exp(-tau);
01333   MSG("SubShowerSR",Msg::kVerbose)<<"Rt "<<Rt<<endl;
01334   p = p + (1-ehat)*(0.348-(0.642/Fs)*exp(-TMath::Power(tau-1,2)));
01335   MSG("SubShowerSR",Msg::kVerbose)<<"p "<<p<<endl;  
01336   Double_t fc = 0;
01337   Double_t ft = 0;
01338   if (r==0.) r = 0.01;
01339   if(r!=0) {
01340     fc = 2*r*Rc*Rc/TMath::Power(r*r+Rc*Rc,2);
01341     ft = 2*r*Rt*Rt/TMath::Power(r*r+Rt*Rt,2);
01342   }
01343     
01344   Double_t f = p*fc+(1-p)*ft;
01345   return f;
01346 }


Generated on 24 Jul 2018 for loon by  doxygen 1.6.1