CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
KalFitAlg Class Reference

#include <KalFitAlg.h>

+ Inheritance diagram for KalFitAlg:

Public Member Functions

Main member functions
 KalFitAlg (const std::string &name, ISvcLocator *pSvcLocator)
 constructor
 
 ~KalFitAlg (void)
 destructor
 
StatusCode initialize ()
 initialize
 
StatusCode execute ()
 event function
 
StatusCode finalize ()
 
StatusCode beginRun ()
 
void hist_def (void)
 hist definition
 
void clean (void)
 
 KalFitAlg (const std::string &name, ISvcLocator *pSvcLocator)
 constructor
 
 ~KalFitAlg (void)
 destructor
 
StatusCode initialize ()
 initialize
 
StatusCode execute ()
 event function
 
StatusCode finalize ()
 
StatusCode beginRun ()
 
void hist_def (void)
 hist definition
 
void clean (void)
 
Set up the description of the Mdc
void set_Mdc (void)
 Set up the wires, layers and superlayers...
 
void setMaterial_Mdc (void)
 Initialize the material for Mdc.
 
void setCylinder_Mdc (void)
 Initialize the cylinders (walls and cathodes) for Mdc.
 
void setDchisqCut (void)
 
void setCalibSvc_init (void)
 initialize for the services
 
void setGeomSvc_init (void)
 
void setMagneticFieldSvc_init (void)
 
void getEventStarTime (void)
 
void set_Mdc (void)
 Set up the wires, layers and superlayers...
 
void setMaterial_Mdc (void)
 Initialize the material for Mdc.
 
void setCylinder_Mdc (void)
 Initialize the cylinders (walls and cathodes) for Mdc.
 
void setDchisqCut (void)
 
void setCalibSvc_init (void)
 initialize for the services
 
void setGeomSvc_init (void)
 
void setMagneticFieldSvc_init (void)
 
void getEventStarTime (void)
 

Kalman filter method related member functions

int usage_
 
int choice_
 
int pathl_
 
int wsag_
 flag to take account the wire sag into account
 
int back_
 flag to perform smoothing
 
int eventno
 
int Tds_back_no
 
double pT_
 value of the pT cut for backward filter
 
int lead_
 leading mass assumption
 
int mhyp_
 
double pe_cut_
 value of the momentum cut to decide refit
 
double pmu_cut_
 
double ppi_cut_
 
double pk_cut_
 
double pp_cut_
 
double pt_cut_
 
double theta_cut_
 
int muls_
 
int loss_
 
int lr_
 
int activeonly_
 
int tofflag_
 
int tof_hyp_
 
int enhance_
 flag to enhance the error matrix at the inner hit of Mdc (cosmic)
 
double fac_h1_
 
double fac_h2_
 
double fac_h3_
 
double fac_h4_
 
double fac_h5_
 
double matrixg_
 
double gain1_
 
double gain2_
 
double gain3_
 
double gain4_
 
double gain5_
 
int steplev_
 
int numfcor_
 
int numf_
 
int inner_steps_
 
int outer_steps_
 
int numf_in_
 
int numf_out_
 
int fitnocut_
 
int drifttime_choice_
 
int i_back_
 mass assumption for backward filter (if <0 means use leading mass)
 
int i_front_
 
int debug_
 Debug flag for the track finder part.
 
int debug_kft_
 
int ntuple_
 Fill ntuples of KalFit.
 
string matfile_
 
string cylfile_
 
double dchi2cutf_
 
double dchi2cuts_
 
double dchi2cut_mid1_
 
double dchi2cut_mid2_
 
double dchi2cut_inner_
 
double dchi2cut_outer_
 
double dchi2cut_layid2_
 
double dchi2cut_layid3_
 
double fstrag_
 factor of energy loss straggling for electron
 
int resolution_
 
int iqual_front_ [5]
 
int iqual_back_
 
int tprop_
 propagation correction
 
int eventNo
 
int m_usevtxdb
 
int m_csmflag
 
double m_dangcut
 
double m_dphicut
 
double m_alpha
 
void filter_fwd_anal (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
 Kalman filter (forward) in Mdc.
 
void filter_fwd_calib (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
 
void init_matrix (MdcRec_trk &trk, HepSymMatrix &Ea)
 
void init_matrix (int k, MdcRec_trk &trk, HepSymMatrix &Ea)
 
void start_seed (KalFitTrack &track, int lead_, int way, MdcRec_trk &trk)
 
void smoother_anal (KalFitTrack &trk, int way)
 Kalman filter (smoothing or backward part)
 
void smoother_calib (KalFitTrack &trk, int way)
 
void innerwall (KalFitTrack &trk, int l_mass, int way)
 Take the inner walls (eloss and mult scat) into account.
 
void innerwall (KalFitTrack &trk, int l_mass, int way, int begin, int end)
 
void innerwall (KalFitTrack &track, int l_mass, int way, double r1, double r2, int &index)
 
void fillTds (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at the inner Mdc hit
 
void fillTds_lead (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass)
 with results got at the outer Mdc hit
 
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol)
 
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol, int smoothflag)
 for smoother process
 
void fillTds_ip (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at (0,0,0)
 
void sameas (RecMdcKalTrack *trk, int l_mass, int imain)
 complete the RecMdcKalTrackCol
 
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol, int flagsmooth)
 
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol)
 
void kalman_fitting_anal (void)
 
void kalman_fitting_calib (void)
 
void kalman_fitting_csmalign (void)
 
void kalman_fitting_MdcxReco_Csmc_Sew (void)
 
void clearTables ()
 
int getWallMdcNumber (const HepPoint3D &point)
 
void extToAnyPoint (KalFitTrack &trk, const HepPoint3D &point)
 
void setBesFromGdml (void)
 
void makeGemHitsCol ()
 
void fromFHitToInnerWall (KalFitTrack &track, int way)
 
void fitGemHits (KalFitTrack &track, int hypo, int way)
 
KalFitTrack Cgem_filter_anal (KalFitTrack &track, int hypo, int way)
 
void residual (KalFitTrack &track)
 
void filter_fwd_anal (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
 Kalman filter (forward) in Mdc.
 
void filter_fwd_calib (KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
 
void init_matrix (MdcRec_trk &trk, HepSymMatrix &Ea)
 
void init_matrix (int k, MdcRec_trk &trk, HepSymMatrix &Ea)
 
void start_seed (KalFitTrack &track, int lead_, int way, MdcRec_trk &trk)
 
void smoother_anal (KalFitTrack &trk, int way)
 Kalman filter (smoothing or backward part)
 
void smoother_calib (KalFitTrack &trk, int way)
 
void innerwall (KalFitTrack &trk, int l_mass, int way)
 Take the inner walls (eloss and mult scat) into account.
 
void innerwall (KalFitTrack &trk, int l_mass, int way, int begin, int end)
 
void innerwall (KalFitTrack &track, int l_mass, int way, double r1, double r2, int &index)
 
void fillTds (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at the inner Mdc hit
 
void fillTds_lead (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass)
 with results got at the outer Mdc hit
 
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol)
 
void fillTds_back (KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass, RecMdcKalHelixSegCol *segcol, int smoothflag)
 for smoother process
 
void fillTds_ip (MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
 with results got at (0,0,0)
 
void sameas (RecMdcKalTrack *trk, int l_mass, int imain)
 complete the RecMdcKalTrackCol
 
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol, int flagsmooth)
 
void complete_track (MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol)
 
void kalman_fitting_anal (void)
 
void kalman_fitting_calib (void)
 
void kalman_fitting_csmalign (void)
 
void kalman_fitting_MdcxReco_Csmc_Sew (void)
 
void clearTables ()
 
int getWallMdcNumber (const HepPoint3D &point)
 
void extToAnyPoint (KalFitTrack &trk, const HepPoint3D &point)
 
void setBesFromGdml (void)
 
void makeGemHitsCol ()
 
void fromFHitToInnerWall (KalFitTrack &track, int way)
 
void fitGemHits (KalFitTrack &track, int hypo, int way)
 
KalFitTrack Cgem_filter_anal (KalFitTrack &track, int hypo, int way)
 
void residual (KalFitTrack &track)
 

Detailed Description

Constructor & Destructor Documentation

◆ KalFitAlg() [1/2]

KalFitAlg::KalFitAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

constructor

Constructor.

Definition at line 99 of file KalFitAlg.cxx.

99 :
100 Algorithm(name, pSvcLocator), m_mdcCalibFunSvc_(0),m_MFSvc_(0),
101 _wire(0), _layer(0), _superLayer(0),
102 pathl_(1), wsag_(4), back_(1), pT_(0.0), lead_(2), mhyp_(31),
103 pe_cut_(2.0), pmu_cut_(2.0), ppi_cut_(2.0), pk_cut_(2.0), pp_cut_(2.0),
105 fac_h1_(1),fac_h2_(1),fac_h3_(1),fac_h4_(1),fac_h5_(1),
106 i_back_(-1), debug_kft_(0), debug_(0), ntuple_(0),eventno(-1),
107 Tds_back_no(0),m_nt1(0),m_nt2(0),m_nt3(0),m_nt4(0),m_nt5(0),
108 iqual_back_(1),tprop_(1),
112 nTotalTrks(0)
113{
114 declareProperty("dchi2cut_layid2",dchi2cut_layid2_ = 10);
115 declareProperty("dchi2cut_layid3",dchi2cut_layid3_ = 10);
116 declareProperty("dchi2cut_inner",dchi2cut_inner_ = 10);
117 declareProperty("dchi2cut_mid1",dchi2cut_mid1_ = 10);
118 declareProperty("dchi2cut_mid2",dchi2cut_mid2_ = 10);
119 declareProperty("dchi2cut_outer",dchi2cut_outer_ = 10);
120 declareProperty("gain1",gain1_ = 1.);
121 declareProperty("gain2",gain2_ = 1.);
122 declareProperty("gain3",gain3_ = 1.);
123 declareProperty("gain4",gain4_ = 1.);
124 declareProperty("gain5",gain5_ = 1.);
125 declareProperty("fitnocut",fitnocut_ = 5);
126 declareProperty("inner_steps",inner_steps_ = 3);
127 declareProperty("outer_steps",outer_steps_ = 3);
128 declareProperty("choice",choice_ = 0);
129 declareProperty("numfcor",numfcor_ = 0);
130 declareProperty("numf",numf_ = 0);
131 declareProperty("steplev",steplev_ = 2);
132 declareProperty("usage",usage_=0);
133 declareProperty("i_front",i_front_=1);
134 declareProperty("lead",lead_=2);
135 declareProperty("muls",muls_=1);
136 declareProperty("loss",loss_=1);
137 declareProperty("matrixg",matrixg_=100.0);
138 declareProperty("lr",lr_=1);
139 declareProperty("debug_kft",debug_kft_=0);
140 declareProperty("debug",debug_=0);
141 declareProperty("ntuple",ntuple_=0);
142 declareProperty("activeonly",activeonly_=0);
143 declareProperty("matfile",matfile_="geomdc_material.dat");
144 declareProperty("cylfile",cylfile_="geomdc_cylinder.dat");
145 declareProperty("dchi2cutf",dchi2cutf_=1000.0);
146 declareProperty("dchi2cuts",dchi2cuts_=1000.0);
147 declareProperty("pt",pT_=0.0);
148 declareProperty("pe_cut",pe_cut_=2.0);
149 declareProperty("pmu_cut",pmu_cut_=2.0);
150 declareProperty("ppi_cut",ppi_cut_=2.0);
151 declareProperty("pk_cut",pk_cut_=2.0);
152 declareProperty("pp_cut",pp_cut_=2.0);
153 declareProperty("wsag",wsag_=4);
154 declareProperty("back",back_=1);
155 declareProperty("i_back",i_back_=1);
156 declareProperty("tofflag",tofflag_=1);
157 declareProperty("tof_hyp",tof_hyp_=1);
158 declareProperty("resolution",resolution_=1);
159 declareProperty("fstrag",fstrag_=0.9);
160 declareProperty("drifttime_choice",drifttime_choice_=0);
161 declareProperty("tprop",tprop_=1);
162 declareProperty("pt_cut",pt_cut_= 0.2);
163 declareProperty("theta_cut",theta_cut_= 0.8);
164 declareProperty("usevtxdb",m_usevtxdb= 0);
165 declareProperty("cosmicflag",m_csmflag= 0);
166 declareProperty("dangcut",m_dangcut=10.);
167 declareProperty("dphicut",m_dphicut=10.);
168 declareProperty("useNCGem",useNCGem_=0);
169 declareProperty("nInnerCFiber",nInnerCFiber_=0);
170 declareProperty("SigRphiGem",myRphiResGem=0.033);
171 declareProperty("SigZGem", myZResGem=0.04);
172 declareProperty("UseGemPos3D", myUseGemPos3D=false);
173 declareProperty("testCDC", testCDC=0);
174 declareProperty("ifProdNt10", ifProdNt10=false);
175 declareProperty("ifProdNt11", ifProdNt11=false);
176 declareProperty("ifProdNt12", ifProdNt12=false);
177
178 for(int i=0; i<5; i++) nFailedTrks[i]=0;
179}
double pe_cut_
value of the momentum cut to decide refit
double fstrag_
factor of energy loss straggling for electron
int i_back_
mass assumption for backward filter (if <0 means use leading mass)
int wsag_
flag to take account the wire sag into account
int debug_
Debug flag for the track finder part.
int enhance_
flag to enhance the error matrix at the inner hit of Mdc (cosmic)
double pT_
value of the pT cut for backward filter

◆ ~KalFitAlg() [1/2]

KalFitAlg::~KalFitAlg ( void  )

destructor

Definition at line 182 of file KalFitAlg.cxx.

183{
184 MsgStream log(msgSvc(), name());
185 log << MSG::INFO <<" Start cleaning, delete Mdc geometry objects" << endreq;
186 clean();
187 log << MSG::INFO << "End cleaning " << endreq;
188}
void clean(void)
Definition: KalFitAlg.cxx:190

◆ KalFitAlg() [2/2]

KalFitAlg::KalFitAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

constructor

◆ ~KalFitAlg() [2/2]

KalFitAlg::~KalFitAlg ( void  )

destructor

Member Function Documentation

◆ beginRun() [1/2]

StatusCode KalFitAlg::beginRun ( )

Definition at line 333 of file KalFitAlg.cxx.

334{
335 MsgStream log(msgSvc(), name());
336 log << MSG::INFO << "in beginRun()" << endreq;
337 log << MSG::INFO << "Present Parameters: muls: " << muls_ <<" loss: "
338 << " activeonly "<< activeonly_ << endreq;
339
340 // initialize the MdcGeomSvc
342 // Wires, Layers and SuperLayers of Mdc :
343 set_Mdc();
344
345 IMagneticFieldSvc* IMFSvc;
346 StatusCode sc = service ("MagneticFieldSvc",IMFSvc);
347 if(sc!=StatusCode::SUCCESS) {
348 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
349 }
350
351 // Nominal magnetic field :
353 KalFitTrack::Bznom_ = (IMFSvc->getReferField())*10000; //unit is KGauss
355
356 if(4 == debug_){
357 std::cout<<" beginRun, referField from MagneticFieldSvc:"<< (IMFSvc->getReferField())*10000 <<std::endl;
358 std::cout<<" magnetic field: "<<KalFitTrack::Bznom_<<std::endl;
359 }
360 }
361
362 return StatusCode::SUCCESS;
363}
virtual double getReferField()=0
void setGeomSvc_init(void)
Definition: KalFitAlg2.cxx:259
void set_Mdc(void)
Set up the wires, layers and superlayers...
Definition: KalFitAlg2.cxx:114
static int numfcor_
NUMF treatment improved.

◆ beginRun() [2/2]

StatusCode KalFitAlg::beginRun ( )

◆ Cgem_filter_anal() [1/2]

KalFitTrack KalFitAlg::Cgem_filter_anal ( KalFitTrack track,
int  hypo,
int  way 
)

—readin clusters of this track

—set the start and stop point of fit

—update track

Definition at line 7251 of file KalFitAlg.cxx.

7252{
7253
7254 ///---readin clusters of this track
7255 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
7256 if (!eventHeader) {
7257 cout << "Could not find Event Header" << endl;
7258 }
7259 int eventNo = eventHeader->eventNumber();
7260 int runNo = eventHeader->runNumber();
7261 SmartDataPtr<RecMdcTrackCol> recMdcTrack(eventSvc(),"/Event/Recon/RecMdcTrackCol");
7262 if (!recMdcTrack) {
7263 cout << "Could not find RecMdcTrackCol" << endl;
7264 }
7265 RecMdcTrackCol::iterator itrk = recMdcTrack->begin();
7266 ClusterRefVec clusterRefVec;
7267 for(; itrk != recMdcTrack->end(); itrk++){
7268 if((*itrk)->trackId() == track.trasan_id() && (*itrk)->getNcluster() > 0) {
7269 clusterRefVec = (*itrk)->getVecClusters();
7270 break;
7271 }
7272 else {
7273 if(4 == debug_) cout<<"run:"<<runNo<<" , Event:"<<eventNo<<" , track:"<<track.trasan_id()<<" has no cluster!"<<endl;
7274 }
7275 }
7276
7277 if(debug_==4){ cout<<"wall size"<<_BesKalmanFitWalls.size()<<endl;}
7278
7279 ///---set the start and stop point of fit
7280 ClusterRefVec::iterator itCluster;
7281 ClusterRefVec::iterator itStartFlag;
7282 ClusterRefVec::iterator itStopFlag;
7283 int step;
7284 int index=0;
7285 double lastR;
7286 double R_o_cgem=_BesKalmanFitWalls[0].radius();
7287 if(way<0){
7288 itStartFlag = clusterRefVec.begin();
7289 itStopFlag = clusterRefVec.end();
7290 lastR=0;
7291 step = 1;
7292 }
7293 else {
7294 itStartFlag = clusterRefVec.end()-1;
7295 itStopFlag = clusterRefVec.begin()-1;
7296 lastR=R_o_cgem;
7297 step = -1;
7298 double pathl;
7299 track.pivot_numf(track.x(track.intersect_cylinder(R_o_cgem)),pathl);
7300 if(KalFitElement::muls()) track.msgasmdc(pathl, way);
7301 if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
7302 }
7303
7304 ///---update track
7305 for(itCluster = itStartFlag; itCluster !=itStopFlag; itCluster = itCluster + step){
7306 int layer = (*itCluster)->getlayerid();
7307 CgemGeoLayer* CgemLayer = m_CgemGeomSvc_->getCgemLayer(layer);
7308 double dmR = CgemLayer->getMiddleROfGapD()/10;
7309 innerwall(track,hypo,way,lastR,dmR,index);
7310 lastR=dmR;
7311 track.update_hits(*itCluster, dmR, way, m_csmflag);
7312 }
7313 KalFitTrack track_first(track);
7314 if(way<0){
7315 innerwall(track,hypo,way,lastR,R_o_cgem,index);
7316 }
7317 else
7318 {
7319 innerwall(track,hypo,way,lastR,0,index);
7320 }
7321
7322 return track_first;
7323}
int runNo
SmartRefVector< RecCgemCluster > ClusterRefVec
void innerwall(KalFitTrack &trk, int l_mass, int way)
Take the inner walls (eloss and mult scat) into account.
Definition: KalFitAlg.cxx:3242
static int muls(void)
static int loss(void)
Description of a track class (<- Helix.cc)
const HepPoint3D & pivot_numf(const HepPoint3D &newPivot)
Sets pivot position in a given mag field.
double intersect_cylinder(double r) const
Intersection with different geometry.
void msgasmdc(double path, int index)
Calculate multiple scattering angle.
void eloss(double path, const KalFitMaterial &m, int index)
Calculate total energy lost in material.
double update_hits(KalFitHitMdc &HitMdc, int inext, CLHEP::Hep3Vector &meas, int way, double &dchi2, double &dtrack, double &dtracknew, double &dtdc, int csmflag)
Include the Mdc wire hits.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.

Referenced by complete_track().

◆ Cgem_filter_anal() [2/2]

KalFitTrack KalFitAlg::Cgem_filter_anal ( KalFitTrack track,
int  hypo,
int  way 
)

◆ clean() [1/2]

void KalFitAlg::clean ( void  )

delete C++ objects, necessary to clean before begin_run or inside destructor

Definition at line 190 of file KalFitAlg.cxx.

191{
192 // delete all Mdc objects :
193 _BesKalmanFitWalls.clear();
194 _BesKalmanFitMaterials.clear();
195 m_innerWall.clear();
196 m_CGEM.clear();
197 m_CGEMMaterials.clear();
198 if(_wire)free(_wire);
199 if(_layer)free(_layer);
200 if(_superLayer)free(_superLayer);
201}

Referenced by initialize(), and ~KalFitAlg().

◆ clean() [2/2]

void KalFitAlg::clean ( void  )

delete C++ objects, necessary to clean before begin_run or inside destructor

◆ clearTables() [1/2]

void KalFitAlg::clearTables ( )

Definition at line 6229 of file KalFitAlg.cxx.

6229 {
6230
6231 if(debug_ == 4) cout<<"Begining to clear Tables ...."<<endl;
6232 vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
6233 vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
6234 vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();
6235 vector<MdcRec_trk>::iterator tit=mdcMgr->begin();
6236 for( ; tit != mdcMgr->end(); tit++) {
6237 vector<MdcRec_wirhit*>::iterator vit= tit->hitcol.begin() ;
6238 for(; vit != tit->hitcol.end(); vit++) {
6239 delete (*vit);
6240 }
6241 }
6242
6243 mdcMgr->clear();
6244 mdc_addMgr->clear();
6245 whMgr->clear();
6246
6247 // delete mdcMgr;
6248 // delete mdc_addMgr;
6249 // delete whMgr;
6250 // mdcMgr = 0;
6251 // mdc_addMgr = 0;
6252 // whMgr = 0;
6253
6254}
static vector< MdcRec_trk_add > * getMdcRecTrkAddCol(void)
Definition: MdcTables.cxx:356
static vector< MdcRec_trk > * getMdcRecTrkCol(void)
Definition: MdcTables.cxx:185
static vector< MdcRec_wirhit > * getMdcRecWirhitCol(void)
Definition: MdcTables.cxx:169

Referenced by execute().

◆ clearTables() [2/2]

void KalFitAlg::clearTables ( )

◆ complete_track() [1/4]

void KalFitAlg::complete_track ( MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol 
)

fill tds with results got at (0,0,0)

Definition at line 5813 of file KalFitAlg.cxx.

5818{
5819 static int nmass = KalFitTrack::nmass();
5820 int way(1);
5821 MsgStream log(msgSvc(), name());
5822 KalFitTrack track_first(track_lead);
5823 KalFitTrack track_ip(track_lead);
5824
5825 if (debug_ == 4){
5826 cout << "track_first pivot "<<track_first.pivot()<< " helix "<<track_first.a()<<endl;
5827 }
5828 if(usage_==1) innerwall(track_ip, lead_, way);
5829 // Fill Tds
5830 fillTds_ip(TrasanTRK, track_ip, kaltrk, lead_);
5831
5832 if (debug_ == 4) {
5833 cout << "after inner wall, track_ip pivot "<<track_first.pivot()<< " helix "<<track_first.a()<<endl;
5834 }
5835
5836 fillTds_lead(TrasanTRK, track_first, kaltrk, lead_);
5837
5838 // Refit for different mass assumptions :
5839 double pp = track_lead.momentum().mag();
5840
5841 //w if (!KalFitDSSD::cosmic_)
5842 if(!(i_front_<0)){
5843
5844 for(int l_mass = 0, flg = 1; l_mass < nmass;
5845 l_mass++, flg <<= 1) {
5846
5847 if (!(mhyp_ & flg)) continue;
5848 if (l_mass == lead_) continue;
5849
5850 // Check the mom. to decide of the refit with this mass assumption
5851 if ((lead_ != 0 && l_mass==0 && pp > pe_cut_) ||
5852 (lead_ != 1 && l_mass==1 && pp > pmu_cut_) ||
5853 (lead_ != 2 && l_mass==2 && pp > ppi_cut_) ||
5854 (lead_ != 3 && l_mass==3 && pp > pk_cut_) ||
5855 (lead_ != 4 && l_mass==4 && pp > pp_cut_))
5856 continue;
5857
5858 if(debug_ == 4) {
5859 cout<<"complete_track..REFIT ASSUMPION " << l_mass << endl;
5860 }
5861
5862 // Initialisation :
5863 double chiSq = 0;
5864 int nhits = 0;
5865
5866 // Initialisation : (x, a, ea)
5867 HepPoint3D x_trasan(TrasanTRK.pivot[0],
5868 TrasanTRK.pivot[1],
5869 TrasanTRK.pivot[2]);
5870
5871 HepVector a_trasan(5);
5872 for(int i = 0; i < 5; i++){
5873 a_trasan[i] = TrasanTRK.helix[i];
5874 }
5875
5876 HepSymMatrix ea_trasan(5);
5877 for(int i = 0, k = 0; i < 5; i++) {
5878 for(int j = 0; j <= i; j++) {
5879 ea_trasan[i][j] = matrixg_*TrasanTRK.error[k++];
5880 ea_trasan[j][i] = ea_trasan[i][j];
5881 }
5882 }
5883
5884 KalFitTrack track(x_trasan,a_trasan, ea_trasan, l_mass, chiSq, nhits);
5885 track.HitsMdc(track_lead.HitsMdc());
5886
5887 double fiTerm = TrasanTRK.fiTerm;
5888 track.pivot(track.x(fiTerm));
5889
5890 HepSymMatrix Eakal(5,0);
5891
5892 double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
5893 if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
5894 choice_ = 6;
5895 }
5896
5897 init_matrix(choice_, TrasanTRK, Eakal);
5898
5899 filter_fwd_calib(track, l_mass, way, Eakal);
5900
5901 KalFitTrack track_z(track);
5902 ///fill tds with results got at (0,0,0)
5903 innerwall(track_z, l_mass, way);
5904 fillTds_ip(TrasanTRK, track_z, kaltrk, l_mass);
5905 // Fill tds
5906 fillTds(TrasanTRK, track, kaltrk, l_mass);
5907 }
5908 } //end of if (!(i_front<0))
5909
5910 // Refit with an enhancement of the error matrix at Mdc level :
5911
5912 if (enhance_) {
5913 HepPoint3D x_first(0, 0, 0);
5914 HepVector a_first(kaltrk->getFHelix());
5915 HepSymMatrix ea_first(kaltrk->getFError());
5916 HepVector fac(5);
5917 fac[0]=fac_h1_; fac[1]=fac_h2_; fac[2]=fac_h3_; fac[3]=fac_h4_; fac[4]=fac_h5_;
5918
5919 for(int i = 0; i < 5; i++)
5920 for(int j = 0; j <= i; j++)
5921 ea_first[i][j] = fac[i]*fac[j]*ea_first[i][j];
5922 KalFitTrack track(x_first, a_first, ea_first, 2, 0, 0);
5923 }
5924
5925 // Backward filter
5926 // Attention, the initial error matrix of track_back is the error matrix
5927 // that after filter_fwd_calib(...) course of track_lead. So one thing need
5928 // more consideration that how to chose the inital error matrix of this smoother,
5929 // to put it by hand or use the error matrix after filter_fwd_calib. I think
5930 // it should be to refer R.G.Brown's book.
5931
5932 KalFitTrack track_back(track_lead);
5933
5934 //track_back(track);
5935
5936
5937 if (debug_ == 4) {
5938 cout << " Backward fitting flag:" << back_<< endl;
5939 cout << "track_back pivot " << track_back.pivot()
5940 << " track_lead kappa " << track_lead.a()[2]
5941 <<endl;
5942 }
5943
5944 if (back_ && track_lead.a()[2] != 0 &&
5945 1/fabs(track_lead.a()[2]) > pT_) {
5946 track_back.HitsMdc(track_lead.HitsMdc());
5947
5949
5950 double p_kaon(0), p_proton(0);
5951
5952 if (!(kaltrk->getStat(0,3))) {
5953 p_kaon = 1 / fabs(kaltrk->getZHelixK()[2]) *
5954 sqrt(1 + kaltrk->getZHelixK()[4]*kaltrk->getZHelixK()[4]);
5955 track_back.p_kaon(p_kaon);
5956 } else {
5957 p_kaon = 1 / fabs(track_back.a()[2]) *
5958 sqrt(1 + track_back.a()[4]*track_back.a()[4]);
5959 track_back.p_kaon(p_kaon);
5960 }
5961 if (!(kaltrk->getStat(0,4))) {
5962 p_proton = 1 / fabs(kaltrk->getZHelixP()[2]) *
5963 sqrt(1 + kaltrk->getZHelixP()[4]*kaltrk->getZHelixP()[4]);
5964 track_back.p_proton(p_proton);
5965 } else {
5966 p_proton = 1 / fabs(track_back.a()[2]) *
5967 sqrt(1 + track_back.a()[4]*track_back.a()[4]);
5968 track_back.p_proton(p_proton);
5969 }
5970
5971 }
5972
5973
5974 if (!(i_back_<0)) {
5975 for(int l_mass = 0; l_mass < nmass; l_mass++) {
5976 KalFitTrack track_seed(track_back);
5977 track_seed.chgmass(l_mass);
5978 smoother_calib(track_seed, -way);
5979 // fill TDS for backward filter :
5980 fillTds_back(track_seed, kaltrk, TrasanTRK, l_mass,segcol);
5981 }
5982 } else {
5983
5984 smoother_calib(track_back, -way);
5985 // fill TDS for backward filter , for leading particle hypothesis :
5986 fillTds_back(track_back, kaltrk, TrasanTRK, lead_,segcol);
5987 // fillTds_helixsegs(track_back,TrasanTRK);
5988 }
5989 }
5990
5991 /*
5992 // Take care of the pointers (use lead. hyp results by default)
5993 for(int pid = 0; pid < nmass;
5994 pid++) {
5995 if (pid == lead_) continue;
5996 if (kaltrk->getStat(1,pid))
5997 sameas(kaltrk, pid, lead_);
5998 }
5999 */
6000
6001 //check: before register into TDS
6002
6003 log << MSG::DEBUG << "registered MDC Kalmantrack:"
6004 << "Track Id: " << kaltrk->getTrackId()
6005 << " Mass of the fit: "<< kaltrk->getMass(2)<< endreq
6006 << "Length of the track: "<< kaltrk->getLength(2)
6007 << " Tof of the track: "<< kaltrk->getTof(2) << endreq
6008 << "Chisq of the fit: "<< kaltrk->getChisq(0,2)
6009 <<" "<< kaltrk->getChisq(1,2) << endreq
6010 << "Ndf of the fit: "<< kaltrk->getNdf(0,2)
6011 <<" "<< kaltrk->getNdf(1,2) << endreq
6012 << "Helix " << kaltrk->getZHelix()[2]
6013 <<endreq;
6014
6015 kalcol->push_back(kaltrk);
6016 track_lead.HitsMdc().clear();
6017 track_back.HelixSegs().clear();
6018 // ??ATTENTION!! should track_back.HelixSegs() be cleared ??
6019}
void filter_fwd_calib(KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
Definition: KalFitAlg.cxx:3044
void fillTds_lead(MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
Definition: KalFitAlg.cxx:1411
void fillTds_ip(MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
with results got at (0,0,0)
Definition: KalFitAlg.cxx:1503
void fillTds(MdcRec_trk &TrasanTRK, KalFitTrack &track, RecMdcKalTrack *trk, int l_mass)
with results got at the inner Mdc hit
Definition: KalFitAlg.cxx:1333
void smoother_calib(KalFitTrack &trk, int way)
Definition: KalFitAlg.cxx:2665
void init_matrix(MdcRec_trk &trk, HepSymMatrix &Ea)
Definition: KalFitAlg.cxx:6022
void fillTds_back(KalFitTrack &track, RecMdcKalTrack *trk, MdcRec_trk &TrasanTRK, int l_mass)
with results got at the outer Mdc hit
Definition: KalFitAlg.cxx:1643
static int nmass(void)
void HitsMdc(vector< KalFitHitMdc > &lh)
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
const HepVector & a(void) const
returns helix parameters.

◆ complete_track() [2/4]

void KalFitAlg::complete_track ( MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol 
)

◆ complete_track() [3/4]

void KalFitAlg::complete_track ( MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol,
int  flagsmooth 
)

fill tds with results got at (0,0,0)

Definition at line 5612 of file KalFitAlg.cxx.

5617{
5618 static int nmass = KalFitTrack::nmass();
5619 int way(1);
5620 MsgStream log(msgSvc(), name());
5621 KalFitTrack track_first(track_lead);
5622 //fromFHitToInnerWall(track_lead, way);
5623 // cout << "m_esti" << m_esti1_r[0] << endl;
5624 //cout<<"fitGemHits for pion"<<endl;
5625 //if(useNCGem_>0) fitGemHits(track_lead, lead_, way);
5626 if(useNCGem_>0)track_first=Cgem_filter_anal(track_lead, lead_, way);
5627 KalFitTrack track_ip(track_lead);
5628 //cout<<"__FUNCTION__: track_lead.nLayerUsed = "<<track_lead.nLayerUsed()<<endl;
5629 //cout<<"__FUNCTION__: track_ip.nLayerUsed = "<<track_ip.nLayerUsed()<<endl;
5630 //innerwall(track_ip, lead_, way,95,99);
5631 // Fill Tds
5632 fillTds_ip(TrasanTRK, track_ip, kaltrk, lead_);
5633 // std::cout<<"track_first nster"<<track_first.nster()<<std::endl;
5634
5635 fillTds_lead(TrasanTRK, track_first, kaltrk, lead_);
5636 // Refit for different mass assumptions :
5637 double pp = track_lead.momentum().mag();
5638
5639 if(!(i_front_<0)){
5640 //cout << "!!!!i_front" << i_front_<< endl;
5641 for(int l_mass = 0, flg = 1; l_mass < nmass;
5642 l_mass++, flg <<= 1) {
5643
5644 if (!(mhyp_ & flg)) continue;
5645 if (l_mass == lead_) continue;
5646
5647 // Check the mom. to decide of the refit with this mass assumption
5648 if ((lead_ != 0 && l_mass==0 && pp > pe_cut_) ||
5649 (lead_ != 1 && l_mass==1 && pp > pmu_cut_) ||
5650 (lead_ != 2 && l_mass==2 && pp > ppi_cut_) ||
5651 (lead_ != 3 && l_mass==3 && pp > pk_cut_) ||
5652 (lead_ != 4 && l_mass==4 && pp > pp_cut_))
5653 continue;
5654 if(debug_ == 4) cout<<"complete_track..REFIT ASSUMPION " << l_mass << endl;
5655 // Initialisation :
5656 double chiSq = 0;
5657 int nhits = 0;
5658
5659 // Initialisation : (x, a, ea)
5660 HepPoint3D x_trasan(TrasanTRK.pivot[0],
5661 TrasanTRK.pivot[1],
5662 TrasanTRK.pivot[2]);
5663 HepVector a_trasan(5);
5664 for(int i = 0; i < 5; i++)
5665 a_trasan[i] = TrasanTRK.helix[i];
5666
5667 HepSymMatrix ea_trasan(5);
5668 for(int i = 0, k = 0; i < 5; i++) {
5669 for(int j = 0; j <= i; j++) {
5670 ea_trasan[i][j] = matrixg_*TrasanTRK.error[k++];
5671 ea_trasan[j][i] = ea_trasan[i][j];
5672 }
5673 }
5674
5675 KalFitTrack track(x_trasan,a_trasan, ea_trasan, l_mass, chiSq, nhits);
5676 track.HitsMdc(track_lead.HitsMdc());
5677 track.trasan_id(TrasanTRK.id);
5678 double fiTerm = TrasanTRK.fiTerm;
5679 track.pivot(track.x(fiTerm));
5680 HepSymMatrix Eakal(5,0);
5681
5682 double costheta = track.a()[4] / sqrt(1.0 + track.a()[4]*track.a()[4]);
5683 if( (1.0/fabs(track.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
5684 choice_ = 6;
5685 }
5686
5687 init_matrix(choice_,TrasanTRK, Eakal);
5688 filter_fwd_anal(track, l_mass, way, Eakal);
5689 KalFitTrack track_z(track);
5690 //fromFHitToInnerWall(track_z, way);
5691 //cout<<"fitGemHits for i="<<l_mass<<endl;
5692 //if(useNCGem_>0) fitGemHits(track_z, l_mass, way);
5693 if(useNCGem_>0) Cgem_filter_anal(track_z, l_mass, way);
5694 ///fill tds with results got at (0,0,0)
5695 //innerwall(track_z, l_mass, way,95,99);
5696 fillTds_ip(TrasanTRK, track_z, kaltrk, l_mass);
5697 // Fill tds
5698 fillTds(TrasanTRK, track, kaltrk, l_mass);
5699 if(ifProdNt12){
5700 if(l_mass==1)residual(track_z);
5701 }
5702 }
5703 } // end of //end of if (!(i_front<0))
5704
5705
5706 // Refit with an enhancement of the error matrix at Mdc level :
5707 if (enhance_) {
5708
5709 HepPoint3D x_first(0, 0, 0);
5710 HepVector a_first(kaltrk->getFHelix());
5711 HepSymMatrix ea_first(kaltrk->getFError());
5712 HepVector fac(5);
5713 fac[0]=fac_h1_; fac[1]=fac_h2_; fac[2]=fac_h3_; fac[3]=fac_h4_; fac[4]=fac_h5_;
5714 for(int i = 0; i < 5; i++)
5715 for(int j = 0; j <= i; j++)
5716 ea_first[i][j] = fac[i]*fac[j]*ea_first[i][j];
5717 KalFitTrack track(x_first, a_first, ea_first, 2, 0, 0);
5718 }
5719
5720 // Backward filter :
5721 KalFitTrack track_back(track_lead);
5722 if (debug_ == 4) {
5723 cout << " Backward fitting flag:" << back_<< endl;
5724 cout << "track_back pivot " << track_back.pivot()
5725 << " track_lead kappa " << track_lead.a()[2]
5726 <<endl;
5727 }
5728
5729 if (back_ && track_lead.a()[2] != 0 &&
5730 1/fabs(track_lead.a()[2]) > pT_) {
5731 track_back.HitsMdc(track_lead.HitsMdc());
5732
5734 double p_kaon(0), p_proton(0);
5735 if (!(kaltrk->getStat(0,3))) {
5736 p_kaon = 1 / fabs(kaltrk->getZHelixK()[2]) *
5737 sqrt(1 + kaltrk->getZHelixK()[4]*kaltrk->getZHelixK()[4]);
5738 track_back.p_kaon(p_kaon);
5739 } else {
5740 p_kaon = 1 / fabs(track_back.a()[2]) *
5741 sqrt(1 + track_back.a()[4]*track_back.a()[4]);
5742 track_back.p_kaon(p_kaon);
5743 }
5744 if (!(kaltrk->getStat(0,4))) {
5745 p_proton = 1 / fabs(kaltrk->getZHelixP()[2]) *
5746 sqrt(1 + kaltrk->getZHelixP()[4]*kaltrk->getZHelixP()[4]);
5747 track_back.p_proton(p_proton);
5748 } else {
5749 p_proton = 1 / fabs(track_back.a()[2]) *
5750 sqrt(1 + track_back.a()[4]*track_back.a()[4]);
5751 track_back.p_proton(p_proton);
5752 }
5753 }
5754
5755 if (!(i_back_<0)) {
5756 //cout<<" *** in smoothing process ***"<<endl;
5757 for(int l_mass = 0; l_mass < nmass; l_mass++) {
5758 //cout<<" --- in hypothesis "<<l_mass<<" :"<<endl;
5759 KalFitTrack track_seed(track_back);
5760 track_seed.chgmass(l_mass);
5761 //cout<<"---------------"<<endl;//wangll
5762 //cout<<"smooth track "<<l_mass<<endl;//wangll
5763 //cout<<" pivot :"<<track_seed.pivot()<<endl;//wangll
5764 //cout<<" helix :"<<track_seed.a()<<endl;//wangll
5765
5766 if(useNCGem_>0) Cgem_filter_anal(track_seed, l_mass, -way);
5767 smoother_anal(track_seed, -way);
5768 // if( usage_ == 1) smoother_calib(track_seed, -way);
5769 //cout<<"fillTds_back 1"<<endl;
5770 // fill TDS for backward filter :
5771 fillTds_back(track_seed, kaltrk, TrasanTRK, l_mass, segcol, 1);
5772 //cout<<"nHits: "<<kaltrk->getVecHelixSegs().size()<<endl;
5773 }
5774 } else {
5775 if(useNCGem_>0) Cgem_filter_anal(track_back, lead_, -way);
5776 smoother_anal(track_back, -way);
5777 //smoother_calib(track_back, -way);
5778 // smoother(track_back, -way);
5779 // fill TDS for backward filter :
5780 //cout<<"fillTds_back 2"<<endl;
5781 fillTds_back(track_back, kaltrk, TrasanTRK, lead_, segcol, 1);
5782 }
5783 }
5784
5785 // Take care of the pointers (use lead. hyp results by default)
5786 for(int pid = 0; pid < nmass;
5787 pid++) {
5788 if (pid == lead_) continue;
5789 if (kaltrk->getStat(1,pid))
5790 sameas(kaltrk, pid, lead_);
5791 }
5792
5793
5794 //check: before register into TDS
5795
5796 log << MSG::DEBUG << "registered MDC Kalmantrack:"
5797 << "Track Id: " << kaltrk->getTrackId()
5798 << " Mass of the fit: "<< kaltrk->getMass(2)<< endreq
5799 << "Length of the track: "<< kaltrk->getLength(2)
5800 << " Tof of the track: "<< kaltrk->getTof(2) << endreq
5801 << "Chisq of the fit: "<< kaltrk->getChisq(0,2)
5802 <<" "<< kaltrk->getChisq(1,2) << endreq
5803 << "Ndf of the fit: "<< kaltrk->getNdf(0,2)
5804 <<" "<< kaltrk->getNdf(1,2) << endreq
5805 << "Helix " << kaltrk->getZHelix()[2]
5806 <<endreq;
5807
5808 kalcol->push_back(kaltrk);
5809 track_lead.HitsMdc().clear();
5810}
void residual(KalFitTrack &track)
Definition: KalFitAlg.cxx:7462
void filter_fwd_anal(KalFitTrack &trk, int l_mass, int way, HepSymMatrix &Eakal)
Kalman filter (forward) in Mdc.
Definition: KalFitAlg.cxx:2803
void smoother_anal(KalFitTrack &trk, int way)
Kalman filter (smoothing or backward part)
Definition: KalFitAlg.cxx:2450
void sameas(RecMdcKalTrack *trk, int l_mass, int imain)
complete the RecMdcKalTrackCol
Definition: KalFitAlg.cxx:2431
KalFitTrack Cgem_filter_anal(KalFitTrack &track, int hypo, int way)
Definition: KalFitAlg.cxx:7251

Referenced by kalman_fitting_anal(), kalman_fitting_calib(), kalman_fitting_csmalign(), and kalman_fitting_MdcxReco_Csmc_Sew().

◆ complete_track() [4/4]

void KalFitAlg::complete_track ( MdcRec_trk TrasanTRK,
MdcRec_trk_add TrasanTRK_add,
KalFitTrack track_lead,
RecMdcKalTrack kaltrk,
RecMdcKalTrackCol kalcol,
RecMdcKalHelixSegCol segcol,
int  flagsmooth 
)

◆ execute() [1/2]

StatusCode KalFitAlg::execute ( )

event function


Definition at line 761 of file KalFitAlg.cxx.

762{
763 MsgStream log(msgSvc(), name());
764 log << MSG::INFO << "in execute()" << endreq;
765 if(testOutput) std::cout<<"begin to deal with EVENT ..."<<(++eventno)<<std::endl;
766 for(int i=0; i<5; i++) iqual_front_[i] = 1;
767 iqual_back_ = 1;
768
769
770 /*
771 MdcID mdcId;
772 SmartDataPtr<RecMdcKalTrackCol> recmdckaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
773 SmartDataPtr<RecMdcKalHelixSegCol> recSegCol(eventSvc(),"/Event/Recon/RecMdcKalHelixSegCol");
774 if(recmdckaltrkCol) {
775 cout<<"------------------------ new event ---------------------"<<endl;
776 cout<<"recmdckaltrkCol->size()="<<recmdckaltrkCol->size()<<endl;
777 cout<<"recSegCol.size()="<<recSegCol->size()<<endl;
778 cout<<"--------------------------------------------------------"<<endl;
779 RecMdcKalTrack::setPidType(RecMdcKalTrack::electron);
780 RecMdcKalTrackCol::iterator KalTrk= recmdckaltrkCol->begin();
781 int i_trk=0;
782 for(;KalTrk !=recmdckaltrkCol->end();KalTrk++){
783 cout<<"*** track "<<i_trk++<<" ***"<<endl;
784 HelixSegRefVec gothelixsegs = (*KalTrk)->getVecHelixSegs();
785 for(int i=0;i<5;i++) cout<<"pid "<<i<<" nSegs="<<((*KalTrk)->getVecHelixSegs(i)).size()<<endl;
786 HelixSegRefVec::iterator iter_hit = gothelixsegs.begin();
787 if(iter_hit == gothelixsegs.end())cout<<"iter_hit == gothelixsegs.end()"<<endl;
788 int nhitofthistrk=0;
789 for( ; iter_hit != gothelixsegs.end(); iter_hit++){
790 nhitofthistrk++;
791 //cout<<"layerId: "<<(*iter_hit)->getLayerId()<<endl;
792 //cout<<"Identifier: "<<(*iter_hit)->getMdcId()<<endl;
793 //cout<<"layerId: "<<mdcId.layer((*iter_hit)->getMdcId())<<endl;
794 //cout<<"getDT: "<<(*iter_hit)->getDT()<<endl;
795 }
796 iter_hit=gothelixsegs.begin();
797 //for(int m=0; m<nhitofthistrk/5;m++){
798 // identifier = (*iter_hit) -> getMdcId();
799 //}
800 cout<<"nhitofthistrk="<<nhitofthistrk<<endl;
801 }
802 }
803 else cout<<"did not find /Event/Recon/RecMdcKalTrackCol"<<endl;
804 */
805
806
807
808
809 ///
810 IMagneticFieldSvc* IMFSvc;
811 StatusCode sc = service ("MagneticFieldSvc",IMFSvc);
812 if(sc!=StatusCode::SUCCESS) {
813 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
814 }
815
816 // Nominal magnetic field :
818 KalFitTrack::Bznom_ = (IMFSvc->getReferField())*10000; //unit is KGauss
820
821 if(4 == debug_){
822 std::cout<<" execute, referField from MagneticFieldSvc: "<< (IMFSvc->getReferField())*10000 <<std::endl;
823 std::cout<<" magnetic field: "<<KalFitTrack::Bznom_<<std::endl;
824 }
825 }
826
828
829 IDataProviderSvc* evtSvc = NULL;
830 Gaudi::svcLocator()->service("EventDataSvc", evtSvc);
831 if (evtSvc) {
832 log << MSG::INFO << "makeTds:event Svc has been found" << endreq;
833 } else {
834 log << MSG::FATAL << "makeTds:Could not find eventSvc" << endreq;
835 return StatusCode::SUCCESS;
836 }
837
838 StatusCode kalsc;
839 IDataManagerSvc *dataManSvc;
840 dataManSvc= dynamic_cast<IDataManagerSvc*>(evtSvc);
841 DataObject *aKalTrackCol;
842 evtSvc->findObject("/Event/Recon/RecMdcKalTrackCol",aKalTrackCol);
843 if(aKalTrackCol != NULL) {
844 dataManSvc->clearSubTree("/Event/Recon/RecMdcKalTrackCol");
845 evtSvc->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
846 }
847
848 kalsc = evtSvc->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
849 if( kalsc.isFailure() ) {
850 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
851 return StatusCode::SUCCESS;
852 }
853 log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
854
855 DataObject *aKalHelixSegCol;
856 evtSvc->findObject("/Event/Recon/RecMdcKalHelixSegCol", aKalHelixSegCol);
857 if(aKalHelixSegCol != NULL){
858 dataManSvc->clearSubTree("/Event/Recon/RecMdcKalHelixSegCol");
859 evtSvc->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
860 }
861 RecMdcKalHelixSegCol *helixsegcol = new RecMdcKalHelixSegCol;
862 kalsc = evtSvc->registerObject("/Event/Recon/RecMdcKalHelixSegCol", helixsegcol);
863 if( kalsc.isFailure()){
864 log<< MSG::FATAL << "Could not register RecMdcKalHelixSeg" <<endreq;
865 return StatusCode::SUCCESS;
866 }
867 log << MSG::INFO << "RecMdcKalHelixSegCol register successfully!" <<endreq;
868
869
870 /*IMdcGeomSvc* geosvc;
871 StatusCode sc = service("MdcGeomSvc", geosvc);
872 if (sc == StatusCode::SUCCESS) {
873 } else {
874 return sc;
875 }*/
876
877 ISvcLocator* svcLocator = Gaudi::svcLocator();
878 ICgemGeomSvc* ISvc;
879 StatusCode Cgem_sc=svcLocator->service("CgemGeomSvc", ISvc);
880 m_CgemGeomSvc_=dynamic_cast<CgemGeomSvc *>(ISvc);
881 if (!Cgem_sc.isSuccess()) log<< MSG::INFO << "KalFitAlg::execute(): Could not open CGEM geometry file" << endreq;
882 //myNCgemLayers = myCgemGeomSvc->getNumberOfCgemLayer();
883 //if(myPrintFlag) cout<<"CgemClusterCreate::initialize() "<<myNCgemLayers<<" Cgem layers"<<endl;
884
885 MdcGeomSvc* const geosvc = dynamic_cast<MdcGeomSvc*>(imdcGeomSvc_);
886 if(!geosvc) {
887 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitAlg::execute ...!!"<<std::endl;
888 }
889
890 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
891 if (!eventHeader) {
892 log << MSG::WARNING << "Could not find Event Header" << endreq;
893 return StatusCode::FAILURE;
894 }
895 int eventNo = eventHeader->eventNumber();
896 int runNo = eventHeader->runNumber();
897 if(runNo>0) wsag_=4;
898 else wsag_=0;
899
900 if(testOutput) cout<<endl<<"$$$$$$$$$$$ run="<<runNo<<", evt="<<eventNo<<" $$$$$$$$$$$$$$$$$"<<endl<<endl;
901
902 double t0=0.;
903 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
904 if (estimeCol && estimeCol->size()) {
905 RecEsTimeCol::iterator iter_evt = estimeCol->begin();
906 t0 = (*iter_evt)->getTest();
907 // t0Stat = (*iter_evt)->getStat();
908 }else{
909 log << MSG::WARNING << "Could not find EvTimeCol" << endreq;
910 return StatusCode::SUCCESS;
911 }
912
913
914 if(debug_==4) {
915 std::cout<<"in KalFitAlg , we get the event start time = "<<t0<<std::endl;
916 }
918
919 SmartDataPtr<MdcDigiCol> mdcDigiCol(evtSvc,"/Event/Digi/MdcDigiCol");
920 if (sc!=StatusCode::SUCCESS) {
921 log << MSG::FATAL << "Could not find MdcDigiCol!" << endreq;
922 return StatusCode::SUCCESS;
923 }
924 KalFitTrack::setMdcDigiCol(mdcDigiCol);
925
926 // register RecMdcTrack and MdcRecHit collection
927
928 if((ntuple_&16)&&(ntuple_&1)) {
929 // McTruth infor,Retrieve MC track truth
930 // bool mcstat = true;
931 // more research needed ...
932
933 m_evtid = eventHeader->eventNumber();
934 bool mcstat = true;
935
936 SmartDataPtr<McParticleCol> mcPartCol(eventSvc(),"/Event/MC/McParticleCol");
937 if (!mcPartCol) {
938 log << MSG::WARNING << "Could not find McParticle" << endreq;
939 mcstat = false;
940 }
941
942 if(mcstat) {
943 McParticleCol::iterator i_mcTrk = mcPartCol->begin();
944 for (;i_mcTrk != mcPartCol->end(); i_mcTrk++) {
945 if(!(*i_mcTrk)->primaryParticle()) continue;
946 const HepLorentzVector& mom((*i_mcTrk)->initialFourMomentum());
947 const HepLorentzVector& pos = (*i_mcTrk)->initialPosition();
948 log << MSG::DEBUG << "MCINFO:particleId=" << (*i_mcTrk)->particleProperty()
949 << " theta=" << mom.theta() <<" phi="<< mom.phi()
950 <<" px="<< mom.px() <<" py="<< mom.py() <<" pz="<< mom.pz()
951 << endreq;
952 double charge = 0.0;
953 int pid = (*i_mcTrk)->particleProperty();
954 int mother_id = ((*i_mcTrk)->mother()).particleProperty();
955 if( pid >0 ) {
956 charge = m_particleTable->particle( pid )->charge();
957 } else if ( pid <0 ) {
958 charge = m_particleTable->particle( -pid )->charge();
959 charge *= -1;
960 } else {
961 log << MSG::WARNING << "wrong particle id, please check data" <<endreq;
962 }
963 HepPoint3D pos2(pos.x(),pos.y(),pos.z());
964 Hep3Vector mom2(mom.px(),mom.py(),mom.pz());
965
966 Helix mchelix(pos2, mom2, charge);
967 log << MSG::DEBUG << "charge of the track " << charge << endreq;
968 if( debug_ == 4) cout<< "helix: "<<mchelix.a()<<endl;
969 mchelix.pivot( HepPoint3D(0,0,0) );
970 for( int j =0; j<5; j++) {
971 m_mchelix[j] = mchelix.a()[j];
972 }
973 m_mcpid = pid;
974 m_mcptot = sqrt(1+pow(m_mchelix[4],2))/m_mchelix[2];
975 if(testOutput)
976 {
977 cout<<"MC pid, mother_id = "<<pid<<", "<<mother_id<<endl;
978 cout<<" p4 = "<<(*i_mcTrk)->initialFourMomentum()<<endl;
979 cout<<" start from "<<(*i_mcTrk)->initialPosition()<<endl;
980 cout<<" end at "<<(*i_mcTrk)->finalPosition()<<endl;
981 cout<<" Helix: "<<mchelix.a()<<endl;
982 cout<<"mc ptot, theta, phi, R = "<<m_mcptot<<", "<<mom2.theta()/acos(-1.)*180<<", "<<mom2.phi()/acos(-1.)*180<<", "<<mchelix.radius()<<endl;
983 }
984 }
985 }
986 }
987
988 Identifier mdcid;
989
990 //retrieve RecMdcTrackCol from TDS
991 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
992 if (!newtrkCol) {
993 log << MSG::FATAL << "Could not find RecMdcTrackCol" << endreq;
994 return( StatusCode::SUCCESS);
995 }
996 log << MSG::INFO << "Begin to make MdcRecTrkCol and MdcRecWirhitCol"<<endreq;
997
998 vector<MdcRec_trk>* mtrk_mgr = MdcRecTrkCol::getMdcRecTrkCol();
999 mtrk_mgr->clear();
1000 vector<MdcRec_trk_add>* mtrkadd_mgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
1001 mtrkadd_mgr->clear();
1002 vector<MdcRec_wirhit>* mhit_mgr = MdcRecWirhitCol::getMdcRecWirhitCol();
1003 mhit_mgr->clear();
1004
1005 double trkx1,trkx2,trky1,trky2,trkz1,trkz2,trkthe1,trkthe2,trkphi1,trkphi2,trkp1,trkp2,trkr1,trkr2,trkkap1,trkkap2,trktanl1,trktanl2;
1006 Hep3Vector csmp3[2];
1007 double csmphi[2];
1008 int status_temp=0;
1009 RecMdcTrackCol::iterator iter_trk = newtrkCol->begin();
1010 for(int kj = 1; iter_trk != newtrkCol->end(); iter_trk++,kj++) {
1011 if(kj<3){
1012 csmp3[kj-1]=(*iter_trk)->p3();
1013 csmphi[kj-1] = (*iter_trk)->phi();
1014 }
1015 if(ntuple_&2) {
1016 //check trackcol, track level
1017 for( int j = 0, ij = 0; j<5; j++) {
1018 m_trkhelix[j] = (*iter_trk)->helix()[j];
1019 if(ntuple_&32) {
1020 for(int k=0; k<=j; k++,ij++) {
1021 m_trkerror[ij] = (*iter_trk)->err()[j][k];
1022 }
1023 }
1024 }
1025 m_trkptot = sqrt(1+pow(m_trkhelix[4],2))/m_trkhelix[2];
1026 if(ntuple_&32){
1027 m_trksigp = sqrt(pow((m_trkptot/m_trkhelix[2]),2)*m_trkerror[5]+
1028 pow((m_trkhelix[4]/m_trkptot),2)*pow((1/m_trkhelix[2]),4)*m_trkerror[14]-
1029 2*m_trkhelix[4]*m_trkerror[12]*pow((1/m_trkhelix[2]),3));
1030 }
1031 m_trkndf = (*iter_trk)->ndof();
1032 m_trkchisq = (*iter_trk)->chi2();
1033
1034 if (debug_ == 4) cout<<"Ea from RecMdcTrackCol..." <<(*iter_trk)->err()<<endl;
1035
1036 StatusCode sc3 = m_nt3->write();
1037 if( sc3.isFailure() ) cout<<"Ntuple3 filling failed!"<<endl;
1038 }
1039 //end of track level check and prepare evt check
1040 if(ntuple_&4) {
1041 /*
1042 if(kj == 1) {
1043 trkphi1 = (*iter_trk)->getFi0();
1044 trkr1 = (*iter_trk)->getDr();
1045 trkz1 = (*iter_trk)->getDz();
1046 trkkap1 = (*iter_trk)->getCpa();
1047 trktanl1 = (*iter_trk)->getTanl();
1048 trkx1 = trkr1*cos(trkphi1);
1049 trky1 = trkr1*sin(trkphi1);
1050 trkp1 = sqrt(1+trktanl1*trktanl1)/trkkap1;
1051 trkthe1 = M_PI/2-atan(trktanl1);
1052 } else if(kj == 2) {
1053 trkphi2 = (*iter_trk)->getFi0();
1054 trkr2 = (*iter_trk)->getDr();
1055 trkz2 = (*iter_trk)->getDz();
1056 trkkap2 = (*iter_trk)->getCpa();
1057 trktanl2 = (*iter_trk)->getTanl();
1058 trkx2 = trkr2*cos(trkphi2);
1059 trky2 = trkr2*sin(trkphi2);
1060 trkp2 = sqrt(1+trktanl2*trktanl2)/trkkap1;
1061 trkthe2 = M_PI/2-atan(trktanl2);
1062 }
1063 */
1064 }
1065 //end prepare
1066
1067 log << MSG::DEBUG << "retrieved MDC tracks:"
1068 << " Nhits " <<(*iter_trk)->getNhits()
1069 << " Nster " <<(*iter_trk)->nster() <<endreq;
1070 // so ,use this to get the hits vector belong to this track ...
1071 HitRefVec gothits = (*iter_trk)->getVecHits();
1072
1073 MdcRec_trk* rectrk = new MdcRec_trk;
1074
1075 rectrk->id = (*iter_trk)->trackId();
1076 rectrk->chiSq = (*iter_trk)->chi2();
1077 rectrk->ndf = (*iter_trk)->ndof();
1078 rectrk->fiTerm = (*iter_trk)->getFiTerm();
1079 rectrk->nhits = (*iter_trk)->getNhits();
1080 rectrk->nster = (*iter_trk)->nster();
1081 rectrk->nclus = 0;
1082 rectrk->stat = (*iter_trk)->stat();
1083 status_temp = (*iter_trk)->stat();
1084 MdcRec_trk_add* trkadd = new MdcRec_trk_add;
1085 trkadd->id = (*iter_trk)->trackId();
1086 trkadd->quality = 0;
1087 trkadd->kind = 1;
1088 trkadd->decision = 0;
1089 trkadd->body = rectrk;
1090 rectrk->add = trkadd;
1091
1092 for ( int i=0; i<5; i++) {
1093 rectrk->helix[i] = (*iter_trk)->helix()[i];
1094 if( i<3 ) rectrk->pivot[i] = (*iter_trk)->getPivot()[i];
1095 for( int j = 1; j<i+2;j++) {
1096 rectrk->error[i*(i+1)/2+j-1] = (*iter_trk)->err()(i+1,j);
1097 }
1098 }
1099 std::sort(gothits.begin(), gothits.end(), order_rechits);
1100 HitRefVec::iterator it_gothit = gothits.begin();
1101 for( ; it_gothit != gothits.end(); it_gothit++) {
1102
1103 if( (*it_gothit)->getStat() != 1 ) {
1104 if(activeonly_) {
1105 log<<MSG::WARNING<<"this hit is not used in helix fitting!"<<endreq;
1106 continue;
1107 }
1108 }
1109
1110 log << MSG::DEBUG << "retrieved hits in MDC tracks:"
1111 << " hits DDL " <<(*it_gothit)->getDriftDistLeft()
1112 << " hits DDR " <<(*it_gothit)->getDriftDistRight()
1113 << " error DDL " <<(*it_gothit)->getErrDriftDistLeft()
1114 << " error DDR " <<(*it_gothit)->getErrDriftDistRight()
1115 << " id of hit "<<(*it_gothit)->getId()
1116 << " track id of hit "<<(*it_gothit)->getTrkId()
1117 << " hits ADC " <<(*it_gothit)->getAdc() << endreq;
1118
1119 MdcRec_wirhit* whit = new MdcRec_wirhit;
1120 whit->id = (*it_gothit)->getId();
1121 whit->ddl = (*it_gothit)->getDriftDistLeft();
1122 whit->ddr = (*it_gothit)->getDriftDistRight();
1123 whit->erddl = (*it_gothit)->getErrDriftDistLeft();
1124 whit->erddr = (*it_gothit)->getErrDriftDistRight();
1125 whit->pChiSq = (*it_gothit)->getChisqAdd();
1126 whit->lr = (*it_gothit)->getFlagLR();
1127 whit->stat = (*it_gothit)->getStat();
1128 mdcid = (*it_gothit)->getMdcId();
1129 int layid = MdcID::layer(mdcid);
1130 int localwid = MdcID::wire(mdcid);
1131 int w0id = geosvc->Layer(layid)->Wirst();
1132 int wid = w0id + localwid;
1133 log << MSG::INFO
1134 << "lr from PR: "<<whit->lr
1135 << " layerId = " << layid
1136 << " wireId = " << localwid
1137 << endreq;
1138
1139 const MdcGeoWire * const wirgeo = geosvc->Wire(wid);
1140
1141 //std::cout<<"the track id of *it_gothit... "<<(*it_gothit)->getTrackId()<<std::endl;
1142 whit->rechitptr = *it_gothit;
1143 whit->geo = wirgeo;
1144 whit->dat = 0;
1145 whit->trk = rectrk;
1146 whit->tdc = (*it_gothit)->getTdc();
1147 whit->adc= (*it_gothit)->getAdc();
1148 rectrk->hitcol.push_back(whit);
1149 mhit_mgr->push_back(*whit);
1150 }
1151 mtrk_mgr->push_back(*rectrk);
1152 mtrkadd_mgr->push_back(*trkadd);
1153
1154 delete rectrk;
1155 delete trkadd;
1156 }
1157
1158 // check trkcol: evt level
1159 if(ntuple_&4) {
1160 m_trkdelx = trkx1 - trkx2;
1161 m_trkdely = trky1 - trky2;
1162 m_trkdelz = trkz1 - trkz2;
1163 m_trkdelthe = trkthe1 + trkthe2;
1164 m_trkdelphi = trkphi1- trkphi2;
1165 m_trkdelp = trkp1 - trkp2;
1166 StatusCode sc4 = m_nt4->write();
1167 if( sc4.isFailure() ) cout<<"Ntuple4 filling failed!"<<endl;
1168 }
1169
1170 if(debug_ == 4) { std::cout<<"before refit,ntrk,nhits,nadd..."<<mtrk_mgr->size()
1171 <<"********"<<mhit_mgr->size()<<"****"<<mtrkadd_mgr->size()<<endl;
1172 }
1173
1174 if(useNCGem_>0) makeGemHitsCol();
1175
1176 // Actual fitter procedure :
1177 //cout << "m_trackid" << m_trackid << endl;
1178 //cout << "m_qua" << m_qua << endl;
1179 //cout << "m_esti" << m_esti1_r[0] << endl;
1180 if(usage_ == 0) kalman_fitting_anal();
1181 if(usage_ == 1) kalman_fitting_calib();
1182 double mdang = 180.0 - csmp3[0].angle(csmp3[1].unit())*180.0/M_PI;
1183 double mdphi = 180.0 - fabs(csmphi[0]-csmphi[1])*180.0/M_PI;
1184 //std::cout<<"before refit,ntrk,nhits,nadd..."<<mtrk_mgr->size()<<" , "<<mhit_mgr->size()<<" , "<<mtrkadd_mgr->size()<<endl;
1185 if(usage_ == 2 && (mtrk_mgr->size())==2 && fabs(mdang)<m_dangcut && fabs(mdphi)<m_dphicut) kalman_fitting_csmalign();
1186 if(usage_ == 3 && (mtrk_mgr->size())==1 && status_temp==-1) kalman_fitting_MdcxReco_Csmc_Sew();
1187
1188 log << MSG::DEBUG <<"after kalman_fitting(),but in execute...."<<endreq;
1189 clearTables();
1190
1191
1192 ///*
1193 // --- test for songxy
1194 MdcID mdcId;
1195 SmartDataPtr<RecMdcKalTrackCol> recmdckaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
1196 //cout<<"------------------------ new event ---------------------"<<endl;
1197 //cout<<"recmdckaltrkCol->size()="<<recmdckaltrkCol->size()<<endl;
1198 //cout<<"--------------------------------------------------------"<<endl;
1200 RecMdcKalTrackCol::iterator KalTrk= recmdckaltrkCol->begin();
1201 int i_trk=0;
1202 for(;KalTrk !=recmdckaltrkCol->end();KalTrk++){
1203 //cout<<"*** track "<<i_trk++<<" ***"<<endl;
1204 for(int hypo=0; hypo<5; hypo++)
1205 {
1206 if((*KalTrk)->getStat(0,hypo)==1) nFailedTrks[hypo]++;
1207 }
1208 HelixSegRefVec gothelixsegs = (*KalTrk)->getVecHelixSegs();
1209 HelixSegRefVec::iterator iter_hit = gothelixsegs.begin();
1210 //if(iter_hit == gothelixsegs.end())cout<<"iter_hit == gothelixsegs.end()"<<endl;
1211 int nhitofthistrk=0;
1212 for( ; iter_hit != gothelixsegs.end(); iter_hit++){
1213 nhitofthistrk++;
1214 //cout<<"layerId: "<<(*iter_hit)->getLayerId()<<endl;
1215 //cout<<"Identifier: "<<(*iter_hit)->getMdcId()<<endl;
1216 //cout<<"layerId: "<<mdcId.layer((*iter_hit)->getMdcId())<<endl;
1217 //cout<<"getDT: "<<(*iter_hit)->getDT()<<endl;
1218 }
1219 iter_hit=gothelixsegs.begin();
1220 //for(int m=0; m<nhitofthistrk/5;m++){
1221 // identifier = (*iter_hit) -> getMdcId();
1222 //}
1223 }
1224 // */
1225
1226 // --- test for getStat(2, pid)
1227 /*
1228 SmartDataPtr<RecMdcKalTrackCol> recmdckaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
1229 SmartDataPtr<RecMdcTrackCol> mdcTrkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
1230 //RecMdcKalTrack::setPidType(RecMdcKalTrack::electron);
1231 RecMdcKalTrackCol::iterator KalTrk= recmdckaltrkCol->begin();
1232 int i_trk=0;
1233 for(RecMdcTrackCol::iterator mdcTrk = mdcTrkCol->begin(); KalTrk !=recmdckaltrkCol->end(); KalTrk++, mdcTrk++){
1234 cout<<"*** track "<<i_trk++<<" ***"<<endl;
1235 cout<<"trackId mdc: "<<(*mdcTrk)->trackId()<<endl;
1236 cout<<"trackId kal: "<<(*KalTrk)->trackId()<<endl;
1237 bool KalIsValid = true;
1238 for(int i_pid=0; i_pid<5; i_pid++) {
1239 cout<<"pid "<<i_pid<<" state 0 : "<<(*KalTrk)->getStat(0, i_pid)<<endl;
1240 cout<<"pid "<<i_pid<<" state 1 : "<<(*KalTrk)->getStat(1, i_pid)<<endl;
1241 if((*KalTrk)->getStat(0, i_pid)==1) {
1242 KalIsValid = false;
1243 switch(i_pid) {
1244 case 0: RecMdcKalTrack::setPidType(RecMdcKalTrack::electron);
1245 break;
1246 case 1: RecMdcKalTrack::setPidType(RecMdcKalTrack::muon);
1247 break;
1248 case 2: RecMdcKalTrack::setPidType(RecMdcKalTrack::pion);
1249 break;
1250 case 3: RecMdcKalTrack::setPidType(RecMdcKalTrack::kaon);
1251 break;
1252 case 4: RecMdcKalTrack::setPidType(RecMdcKalTrack::proton);
1253 break;
1254 }
1255 cout<<"Helix Kal: "<<(*KalTrk)->helix()<<endl;
1256 cout<<"Helix Kal err: "<<(*KalTrk)->err()<<endl;
1257 }
1258 }
1259 if(!KalIsValid) {
1260 cout<<"Helix Mdc: "<<(*mdcTrk)->helix()<<endl;
1261 cout<<"Helix Mdc err: "<<(*mdcTrk)->err()<<endl;
1262 }
1263 }
1264 */
1265 if(ifProdNt11)
1266 {
1267 SmartDataPtr<Event::CgemMcHitCol> cgemMcHitCol(eventSvc(), "/Event/MC/CgemMcHitCol");
1268 if (!cgemMcHitCol){
1269 log << MSG::WARNING << "Could not retrieve Cgem MC truth" << endreq;
1270 return StatusCode::FAILURE;
1271 }
1272 m_evt4=eventHeader->eventNumber();
1273 Event::CgemMcHitCol::iterator iter_truth = cgemMcHitCol->begin();
1274 int jj=0;
1275 double dprex,dprey,dprez,dpostx,dposty,dpostz;
1276 int layer;
1277 for(; iter_truth != cgemMcHitCol->end(); ++iter_truth){
1278 layer = (*iter_truth)->GetLayerID();
1279 dprex = (*iter_truth)->GetPositionXOfPrePoint();
1280 dprey = (*iter_truth)->GetPositionYOfPrePoint();
1281 dprez = (*iter_truth)->GetPositionZOfPrePoint();
1282 dpostx = (*iter_truth)->GetPositionXOfPostPoint();
1283 dposty = (*iter_truth)->GetPositionYOfPostPoint();
1284 dpostz = (*iter_truth)->GetPositionZOfPostPoint();
1285
1286 double midx=0;
1287 double midy=0;
1288 CgemGeoLayer* CgemLayer = m_CgemGeomSvc_->getCgemLayer(layer);
1289 double diR = CgemLayer->getInnerROfGapD();
1290 double dmR = CgemLayer->getMiddleROfGapD();
1291 double doR = CgemLayer->getOuterROfGapD();
1292 if((dprex >=0&&dprey>=0)||(dprex <0&&dprey>=0)){
1293 //m_dtphi[jj] = acos(dprex/dr_layer[layer]);
1294 m_dtphi[jj] = acos(dprex/diR);
1295 m_dtv[jj] = dprez;
1296 //m_dtpostphi[jj] = acos(dpostx/dor_layer[layer]);
1297 m_dtpostphi[jj] = acos(dpostx/doR);
1298 m_dtpostz[jj]= dpostz;
1299 }
1300 if((dprex <0&&dprey<0)||(dprex >=0&&dprey<0)){
1301 //m_dtphi[jj] = -acos(dprex/dr_layer[layer]);
1302 m_dtphi[jj] = -acos(dprex/diR);
1303 m_dtv[jj] = dprez;
1304 //m_dtpostphi[jj] = -acos(dpostx/dor_layer[layer]);
1305 m_dtpostphi[jj] = -acos(dpostx/doR);
1306 m_dtpostz[jj]= dpostz;
1307 }
1308 midx=(dprex+dpostx)/2;
1309 midy=(dprey+dposty)/2;
1310 if((midx>=0&&midy>=0)||(midx<0&&midy>=0)){
1311 //m_dtphi[jj]=acos(midx/dmr_layer[layer]);
1312 m_dtphi[jj]=acos(midx/dmR);
1313 }
1314 if((midx<0&&midy<0)||(midx>=0&&midy<0)){
1315 //m_dtphi[jj]=-acos(midx/dmr_layer[layer]);
1316 m_dtphi[jj]=-acos(midx/dmR);
1317 }
1318 m_dtv[jj] = (m_dtv[jj]+m_dtpostz[jj])/20;
1319 m_tlayer[jj] = layer;
1320 jj++;
1321 }
1322 m_ntruth = jj;
1323
1324 m_nt11->write();
1325 }
1326
1327
1328
1329 return StatusCode::SUCCESS;
1330}
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in !Latex Output unit
Definition: FoamA.h:90
ObjectVector< RecMdcKalHelixSeg > RecMdcKalHelixSegCol
SmartRefVector< RecMdcKalHelixSeg > HelixSegRefVec
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
SmartRefVector< RecMdcHit > HitRefVec
bool testOutput
Definition: KalFitAlg.cxx:96
#define M_PI
Definition: TConstant.h:4
void kalman_fitting_MdcxReco_Csmc_Sew(void)
Definition: KalFitAlg.cxx:4561
void kalman_fitting_calib(void)
Definition: KalFitAlg.cxx:3972
void makeGemHitsCol()
Definition: KalFitAlg.cxx:6738
void kalman_fitting_anal(void)
Definition: KalFitAlg.cxx:3340
void kalman_fitting_csmalign(void)
Definition: KalFitAlg.cxx:5050
void clearTables()
Definition: KalFitAlg.cxx:6229
static void setMdcDigiCol(MdcDigiCol *digicol)
static void setT0(double t0)
const MdcGeoWire *const Wire(unsigned id)
Definition: MdcGeomSvc.cxx:770
const MdcGeoLayer *const Layer(unsigned id)
Definition: MdcGeomSvc.cxx:786
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)

◆ execute() [2/2]

StatusCode KalFitAlg::execute ( )

event function

◆ extToAnyPoint() [1/2]

void KalFitAlg::extToAnyPoint ( KalFitTrack trk,
const HepPoint3D point 
)

◆ extToAnyPoint() [2/2]

void KalFitAlg::extToAnyPoint ( KalFitTrack trk,
const HepPoint3D point 
)

◆ fillTds() [1/2]

void KalFitAlg::fillTds ( MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass 
)

with results got at the inner Mdc hit

Definition at line 1333 of file KalFitAlg.cxx.

1334 {
1335
1336 HepPoint3D IP(0,0,0);
1337 track.pivot(IP);
1338 // Fit quality
1339 int iqual(1);
1340 int trasster = TrasanTRK.nster, trakster = track.nster(),
1341 trasax(TrasanTRK.nhits-trasster), trakax(track.nchits()-trakster);
1342 if (TrasanTRK.nhits-track.nchits()>fitnocut_ ||
1343 TrasanTRK.helix[2]*track.a()[2]<0)
1344 iqual = 0;
1345
1346 if (debug_ == 4) {
1347 cout<< "trasster trakster trasax trakax TrasK trackK iqual"<<endl
1348 <<trasster<<" "<<trakster<<" "<<trasax<<" "<<trakax
1349 <<" "<<TrasanTRK.helix[2]<<" "<<track.a()[2]<<" "<<iqual<<endl;
1350 cout<<"FillTds> track.chiSq..."<<track.chiSq()<<" nchits "<<track.nchits()
1351 <<" nster "<<track.nster()<<" iqual "<<iqual<<" track.Ea "<< track.Ea()<<endl;
1352
1353 cout<<"fillTds>.....track.Ea[2][2] "<<track.Ea()[2][2]<<endl;
1354 cout << " TRASAN stereo = " << trasster
1355 << " and KalFitTrack = " << trakster << std::endl;
1356 cout << " TRASAN axial = " << trasax
1357 << " and KalFitTrack = " << trakax << std::endl;
1358
1359 if (!iqual) {
1360 cout << "...there is a problem during fit !! " << std::endl;
1361 if (trasster-trakster>5)
1362 cout << " because stereo " << trasster-trakster << std::endl;
1363 if (trasax-trakax >5)
1364 cout << " because axial " << std::endl;
1365 if (TrasanTRK.helix[2]*track.a()[2]<0)
1366 cout << " because kappa sign " << std::endl;
1367 }
1368 }
1369 // Protection : if any problem, we keep the original information !!!!
1370 if (track.nchits() > 5 && track.nster() > 1 &&
1371 track.nchits()-track.nster() > 2 && track.chiSq() > 0 &&
1372 track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 &&
1373 track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 &&
1374 track.Ea()[4][4] > 0 && iqual) {
1375 if(debug_ == 4) cout<<"fillTds>.....going on "<<endl;
1376 trk->setStat(0,0,l_mass);
1377 trk->setMass(track.mass(),l_mass);
1378
1379 // chisq & ndf
1380 trk->setChisq(track.chiSq(),0,l_mass);
1381 trk->setNdf(track.nchits()-5,0,l_mass);
1382 trk->setNhits(track.nchits(),l_mass);
1383
1384 trk->setFHelix(track.a(),l_mass);
1385 trk->setFError(track.Ea(),l_mass);
1386
1387 } else {
1388
1389 if(debug_) cout<<"ALARM: FillTds Not refit with KalFilter!!!"<<endl;
1390 // NOT refit with Kalman filter :
1391 trk->setStat(1,0,l_mass);
1392 trk->setMass(KalFitTrack::mass(l_mass),l_mass);
1393 // chisq & ndf (0 : filter ; 1 : smoother;)
1394 trk->setChisq(TrasanTRK.chiSq,0,l_mass);
1395 trk->setNdf(TrasanTRK.nhits-5,0,l_mass);
1396 // nhits
1397 trk->setNhits(TrasanTRK.nhits,l_mass);
1398 double a_trasan[5], ea_trasan[15];
1399 for( int i =0 ; i <5; i++){
1400 a_trasan[i] = TrasanTRK.helix[i];
1401 }
1402 for( int j =0 ; j <15; j++){
1403 ea_trasan[j] = TrasanTRK.error[j];
1404 }
1405 trk->setFHelix(a_trasan, l_mass);
1406 trk->setFError(ea_trasan,l_mass);
1407 }
1408}
void setFHelix(const HepVector &fhelix, const int pid)
void setFError(const HepSymMatrix &ferror, const int pid)
const HepSymMatrix & Ea(void) const
returns error matrix.
const HepPoint3D & pivot(void) const
returns pivot position.

Referenced by complete_track().

◆ fillTds() [2/2]

void KalFitAlg::fillTds ( MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass 
)

with results got at the inner Mdc hit

◆ fillTds_back() [1/6]

void KalFitAlg::fillTds_back ( KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass 
)

with results got at the outer Mdc hit

right???

Definition at line 1643 of file KalFitAlg.cxx.

1645{
1646
1647 HepPoint3D IP(0,0,0);
1648 //track.pivot(IP);
1649
1650 // Fit quality
1651 int iqual(1);
1652
1653 if ((trk->getNdf(0,l_mass))-(track.ndf_back()-5)>5) iqual = 0;
1654
1655 if(debug_ == 4) cout<< "fillTds_back> mass "<<trk->getMass(2)<<" ndf[0] "<<trk->getNdf(0,2)<<endl;
1656 if(debug_ == 4) cout<<"ndf_back "<< track.ndf_back() << " chi2_back " << track.chiSq_back()<<endl;
1657
1658 if (track.ndf_back() > 5 && track.chiSq_back() > 0 &&
1659 track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 &&
1660 track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 &&
1661 track.Ea()[4][4] > 0 && fabs(track.a()[0]) < DBL_MAX &&
1662 fabs(track.a()[1]) < DBL_MAX && fabs(track.a()[2]) < DBL_MAX &&
1663 fabs(track.a()[3]) < DBL_MAX && fabs(track.a()[4]) < DBL_MAX &&
1664 iqual) {
1665
1666 // chisq ( for backward filter)
1667
1668 trk->setStat(0,1,l_mass);
1669 trk->setChisq(track.chiSq_back(),1,l_mass);
1670 trk->setNdf(track.ndf_back()-5,1,l_mass);
1671 trk->setLength(track.pathip(),l_mass);
1672 if(debug_ == 4) cout<<"l_mass "<<l_mass<<" path set as "<<track.pathip()<<endl;
1673 trk->setTof(track.tof(),l_mass);
1674
1676 if(l_mass == 3) trk->setTof(track.tof_kaon(),l_mass);
1677 if(l_mass == 4) trk->setTof(track.tof_proton(),l_mass);
1678 }
1679
1680 // Path length in each MDC layer :
1681 if (pathl_)
1682 for (int i = 0; i<43; i++) {
1683 trk->setPathl(track.pathl()[i],i);
1684 }
1685
1686 trk->setLHelix(track.a(),l_mass);
1687 trk->setLError(track.Ea(),l_mass);
1688 trk->setLPivot(track.pivot(),l_mass);
1689
1690 trk->setLPoint(track.point_last(),l_mass);
1691 trk->setPathSM(track.getPathSM(),l_mass);
1692 trk->setTof(track.getTofSM(),l_mass);
1693 trk->setFiTerm(track.getFiTerm(),l_mass);
1694
1695 if(4 == debug_){
1696 std::cout<<" last pivot: "<< trk->getLPivot(0)<<std::endl;
1697 std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
1698 std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;
1699 std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
1700 }
1701
1702 } else {
1703 if(debug_) cout<<"ALARM: FillTds_back Not refit with KalFilter!!!"<<endl;
1704 // NOT refit with Kalman filter :
1705 trk->setStat(1,1,l_mass);
1706 HepPoint3D piv(TrasanTRK.pivot[0],
1707 TrasanTRK.pivot[1],
1708 TrasanTRK.pivot[2]);
1709
1710 HepVector a(5);
1711 for(int i = 0; i < 5; i++)
1712 a[i] = TrasanTRK.helix[i];
1713
1714 HepSymMatrix ea(5);
1715 for(int i = 0, k = 0; i < 5; i++) {
1716 for(int j = 0; j <= i; j++) {
1717 ea[i][j] = matrixg_*TrasanTRK.error[k++];
1718 ea[j][i] = ea[i][j];
1719 }
1720 }
1721
1722 KalFitTrack track_rep(piv, a, ea, lead_,
1723 TrasanTRK.chiSq, TrasanTRK.nhits);
1724 double fiTerm = TrasanTRK.fiTerm;
1725
1726 double fi0 = track_rep.phi0();
1727 HepPoint3D xc(track_rep.kappa()/fabs(track_rep.kappa())*
1728 track_rep.center() );
1729 double x = xc.x();
1730 double y = xc.y();
1731 double phi_x;
1732 if( fabs( x ) > 1.0e-10 ){
1733 phi_x = atan2( y, x );
1734 if( phi_x < 0 ) phi_x += 2*M_PI;
1735 } else {
1736 phi_x = ( y > 0 ) ? M_PI_4: 3.0*M_PI_4;
1737 }
1738 if(debug_ == 4) cout<<"fiterm "<<fiTerm<<" fi0 "<<fi0<<" phi_x "<<phi_x<<endl;
1739 double dphi = fabs( fiTerm + fi0 - phi_x );
1740 if( dphi >= 2*M_PI ) dphi -= 2*M_PI;
1741 double tanl = track_rep.tanl();
1742 double cosl_inv = sqrt( tanl*tanl + 1.0 );
1743 if(debug_ == 4) {
1744 cout<<"tanl= "<<tanl<<" radius "<<track_rep.radius()<<" dphi "<<dphi<<endl;
1745 cout<<" cosl_inv "<<cosl_inv<<" radius_numf "<<track_rep.radius_numf()<<endl;
1746 }
1747 double track_len(fabs( track_rep.radius() * dphi * cosl_inv ));
1748 double light_speed( 29.9792458 ); // light speed in cm/nsec
1749 double pt( 1.0 / track_rep.kappa() );
1750 double p( pt * sqrt( 1.0 + tanl*tanl ) );
1751
1752 // chisq (2 : for backward filter)
1753 trk->setStat(1,1,l_mass);
1754 trk->setChisq(TrasanTRK.chiSq,1,l_mass);
1755 if(debug_ == 4) {
1756 std::cout<<".....fillTds_back...chiSq..."<< TrasanTRK.chiSq<<endl;
1757 std::cout<<"...track_len..."<<track_len<<" ndf[1] "<< trk->getNdf(0,l_mass)<<endl;
1758 }
1759 trk->setNdf(TrasanTRK.nhits-5,1,l_mass);
1760 trk->setLength(track_len,l_mass);
1761 double mass_over_p( KalFitTrack::mass(l_mass)/ p );
1762 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
1763 trk->setTof(track_len / ( light_speed * beta ), l_mass) ;
1764
1765 track_rep.pivot(IP);
1766
1767 trk->setLHelix(track_rep.a(),l_mass);
1768 trk->setLError(track_rep.Ea(),l_mass);
1769 trk->setLPivot(track.pivot(),l_mass);
1770
1771 /// right???
1772 trk->setLPoint(track.point_last(),l_mass);
1773 trk->setPathSM(track.getPathSM(),l_mass);
1774 trk->setTof(track.getTofSM(),l_mass);
1775 trk->setFiTerm(track.getFiTerm(),l_mass);
1776 }
1777
1778 // test--------
1779 if(debug_ == 4) {
1780
1781 std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
1782 std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
1783 std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;
1784
1785 cout<<"Now let us see results after smoothering at IP:........."<<endl;
1786 cout << " dr = " << track.a()[0]
1787 << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
1788 cout<< " phi0 = " << track.a()[1]
1789 << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
1790 cout << " PT = " << 1/track.a()[2]
1791 << ", Er_kappa = " << sqrt(track.Ea()[2][2]) << std::endl;
1792 cout << " dz = " << track.a()[3]
1793 << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
1794 cout << " tanl = " << track.a()[4]
1795 << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
1796 cout << " Ea = " << track.Ea() <<endl;
1797 }
1798 // test end ----------
1799}
Double_t x[10]
void point_last(const HepPoint3D &point)
set and give out the last point of the track
void tof(double path)
Update the tof estimation.
void setLHelix(const HepVector &helix, const int pid)
void setLError(const HepSymMatrix &error, const int pid)
void setLPoint(const HepPoint3D &point, const int pid)
void setLPivot(const HepPoint3D &pivot, const int pid)

Referenced by complete_track().

◆ fillTds_back() [2/6]

void KalFitAlg::fillTds_back ( KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass 
)

with results got at the outer Mdc hit

◆ fillTds_back() [3/6]

void KalFitAlg::fillTds_back ( KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol 
)

right???

Definition at line 1801 of file KalFitAlg.cxx.

1804{
1805
1806 HepPoint3D IP(0,0,0);
1807
1808 // attention the pivot problem of the HelixSeg ... ???
1809 track.pivot(IP);
1810 // Fit quality
1811 //int iqual(1);
1812 //if ((trk->getNdf(0,2))-(track.ndf_back()-5)>5)
1813 // form getNdf(0,2) to getNdf(0,1) for muon hypothesis
1814
1815 if ((trk->getNdf(0,l_mass))-(track.ndf_back()-5)>5){
1816 iqual_back_ = 0;
1817 }
1818 if(usage_>1){
1819 for(int i=0; i<5; i++) iqual_front_[i] = 1;
1820 iqual_back_ = 1;
1821 }
1822 if(debug_ == 4){
1823 std::cout<< "fillTds_back> mass "<<trk->getMass(2)<<" ndf[0][l_mass] "<<trk->getNdf(0,l_mass)<<endl;
1824 std::cout<<"ndf_back "<< track.ndf_back() << " chi2_back " << track.chiSq_back()<<endl;
1825 std::cout<<"track.ndf_back(), track.chiSq_back(), track.Ea()[5][5], track.a()[5], iqual_front_, iqual_back_: "<<track.ndf_back()<<" , "<<track.chiSq_back()<<" , "<<track.Ea()<<" , "<<track.a()<<" , "<<iqual_front_[l_mass]<<" , "<<iqual_back_<<std::endl;
1826 }
1827
1828 if (track.ndf_back() > 5 && track.chiSq_back() > 0 &&
1829 track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 &&
1830 track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 &&
1831 track.Ea()[4][4] > 0 && fabs(track.a()[0]) < DBL_MAX &&
1832 fabs(track.a()[1]) < DBL_MAX && fabs(track.a()[2]) < DBL_MAX &&
1833 fabs(track.a()[3]) < DBL_MAX && fabs(track.a()[4]) < DBL_MAX && iqual_front_[l_mass] && iqual_back_){
1834
1835 // chisq ( for backward filter)
1836 //std::cout<<"begin to fillTds_back track no. : "<<(++Tds_back_no)<<std::endl;
1837
1838
1839 HelixSegRefVec helixsegrefvec;
1840 for (vector<KalFitHelixSeg>::iterator it = track.HelixSegs().begin(); it!=track.HelixSegs().end();it ++)
1841 {
1842
1843 //std::cout<<" alpha of KalFitHelixSeg: "<<it->alpha()<<std::endl;
1844 //std::cout<<" doca1 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
1845
1846 it->pivot(IP);
1847
1848 //std::cout<<" doca2 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
1849
1850 RecMdcKalHelixSeg* helixseg = new RecMdcKalHelixSeg;
1851 helixseg->setResIncl(it->residual_include());
1852 helixseg->setResExcl(it->residual_exclude());
1853 if(debug_ == 4) {
1854 std::cout<<"helixseg->Res_inc ..."<<helixseg->getResIncl()<<std::endl;
1855 }
1856 helixseg->setDrIncl(it->a_include()[0]);
1857 helixseg->setFi0Incl(it->a_include()[1]);
1858 helixseg->setCpaIncl(it->a_include()[2]);
1859 helixseg->setDzIncl(it->a_include()[3]);
1860 helixseg->setTanlIncl(it->a_include()[4]);
1861
1862
1863 helixseg->setDrExcl(it->a_exclude()[0]);
1864 helixseg->setFi0Excl(it->a_exclude()[1]);
1865 helixseg->setCpaExcl(it->a_exclude()[2]);
1866 helixseg->setDzExcl(it->a_exclude()[3]);
1867 helixseg->setTanlExcl(it->a_exclude()[4]);
1868
1869 helixseg->setHelixIncl(it->a_include());
1870 helixseg->setErrorIncl(it->Ea_include());
1871
1872 //Helix temp(IP, it->a(), it->Ea());
1873
1874 //std::cout<<" doca3 of KalFitHelixSeg: "<<(temp.approach(*(it->HitMdc()),false))<<std::endl;
1875
1876 helixseg->setHelixExcl(it->a_exclude());
1877 helixseg->setErrorExcl(it->Ea_exclude());
1878 helixseg->setLayerId(it->layer());
1879
1880 if(debug_ == 4) {
1881 std::cout<<"KalFitHelixSeg track id .."<<it->HitMdc()->rechitptr()->getTrkId()<<std::endl;
1882 std::cout<<"helixseg a: "<<it->a()<<std::endl;
1883 std::cout<<"helixseg a_excl: "<<helixseg->getHelixExcl()<<std::endl;
1884 std::cout<<"helixseg a_incl: "<<helixseg->getHelixIncl()<<std::endl;
1885
1886 std::cout<<"helixseg Ea: "<<it->Ea()<<std::endl;
1887 std::cout<<"helixseg Ea_excl: "<<helixseg->getErrorExcl()<<std::endl;
1888 std::cout<<"helixseg Ea_incl: "<<helixseg->getErrorIncl()<<std::endl;
1889
1890 std::cout<<"helixseg layer: "<<it->layer()<<std::endl;
1891 }
1892
1893
1894 helixseg->setTrackId(it->HitMdc()->rechitptr()->getTrkId());
1895 helixseg->setMdcId(it->HitMdc()->rechitptr()->getMdcId());
1896 helixseg->setFlagLR(it->HitMdc()->LR());
1897 helixseg->setTdc(it->HitMdc()->rechitptr()->getTdc());
1898 helixseg->setAdc(it->HitMdc()->rechitptr()->getAdc());
1899 helixseg->setZhit(it->HitMdc()->rechitptr()->getZhit());
1900 helixseg->setTof(it->tof());
1901 helixseg->setDocaIncl(it->doca_include());
1902 helixseg->setDocaExcl(it->doca_exclude());
1903 helixseg->setDD(it->dd());
1904 helixseg->setEntra(it->HitMdc()->rechitptr()->getEntra());
1905 helixseg->setDT(it->dt());
1906 segcol->push_back(helixseg);
1907 SmartRef<RecMdcKalHelixSeg> refhelixseg(helixseg);
1908 helixsegrefvec.push_back(refhelixseg);
1909
1910 if(ntuple_&8){
1911 m_docaInc = helixseg -> getDocaIncl();
1912 m_docaExc = helixseg -> getDocaExcl();
1913 m_residualInc = helixseg -> getResIncl();
1914 m_residualExc = helixseg -> getResExcl();
1915 m_dd = helixseg -> getDD();
1916 m_lr = helixseg->getFlagLR();
1917 m_tdrift = helixseg -> getDT();
1918 m_layerid = helixseg -> getLayerId();
1919 m_yposition= it->HitMdc()->wire().fwd().y();
1920 m_eventNo = eventNo;
1921 StatusCode sc6 = m_nt6->write();
1922 if( sc6.isFailure() ) cout<<"Ntuple6 helixseg filling failed!"<<endl;
1923
1924 }
1925 }
1926
1927 trk->setVecHelixSegs(helixsegrefvec, l_mass);
1928 if(debug_ == 4) {
1929 std::cout<<"trk->getVecHelixSegs size..."<<(trk->getVecHelixSegs()).size()<<std::endl;
1930 }
1931 trk->setStat(0,1,l_mass);
1932 trk->setChisq(track.chiSq_back(),1,l_mass);
1933 trk->setNdf(track.ndf_back()-5,1,l_mass);
1934 // add setNhits ,maybe some problem
1935 trk->setNhits(track.ndf_back(),l_mass);
1936 if(!(track.ndf_back()==track.HelixSegs().size())) {
1937 std::cout<<"THEY ARE NOT EQUALL!!!"<<std::endl;
1938 }
1939 trk->setLength(track.pathip(),l_mass);
1940 if(debug_ == 4) {
1941 std::cout<<"l_mass "<<l_mass<<" path set as "<<track.pathip()<<endl;
1942 }
1943 trk->setTof(track.tof(),l_mass);
1945 if(l_mass == 3) trk->setTof(track.tof_kaon(),l_mass);
1946 if(l_mass == 4) trk->setTof(track.tof_proton(),l_mass);
1947 }
1948 // Path length in each MDC layer :
1949 if (pathl_)
1950 for (int i = 0; i<43; i++) {
1951 trk->setPathl(track.pathl()[i],i);
1952 }
1953 trk->setLHelix(track.a(),l_mass);
1954 trk->setLError(track.Ea(),l_mass);
1955 trk->setLPivot(track.pivot(),l_mass);
1956
1957 trk->setLPoint(track.point_last(),l_mass);
1958 trk->setPathSM(track.getPathSM(),l_mass);
1959 trk->setTof(track.getTofSM(),l_mass);
1960 trk->setFiTerm(track.getFiTerm(),l_mass);
1961 double a_trasan[5], ea_trasan[15];
1962 for( int i =0 ; i <5; i++){
1963 a_trasan[i] = TrasanTRK.helix[i];
1964 }
1965 for( int j =0 ; j <15; j++){
1966 ea_trasan[j] = TrasanTRK.helix[j];
1967 }
1968 trk->setTHelix(a_trasan);
1969 trk->setTError(ea_trasan);
1970
1971 if(4 == debug_){
1972 std::cout<<" last pivot: "<< trk->getLPivot(0)<<std::endl;
1973 std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
1974 std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;
1975 std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
1976 }
1977
1978 } else {
1979
1980 if(debug_) cout<<"ALARM: FillTds_back Not refit with KalFilter!!!"<<endl;
1981 // NOT refit with Kalman filter :
1982 trk->setStat(1,1,l_mass);
1983
1984 HepPoint3D piv(TrasanTRK.pivot[0],
1985 TrasanTRK.pivot[1],
1986 TrasanTRK.pivot[2]);
1987
1988 HepVector a(5);
1989 for(int i = 0; i < 5; i++)
1990 a[i] = TrasanTRK.helix[i];
1991
1992 HepSymMatrix ea(5);
1993 for(int i = 0, k = 0; i < 5; i++) {
1994 for(int j = 0; j <= i; j++) {
1995 ea[i][j] = matrixg_*TrasanTRK.error[k++];
1996 ea[j][i] = ea[i][j];
1997 }
1998 }
1999
2000 KalFitTrack track_rep(piv, a, ea, lead_,
2001 TrasanTRK.chiSq, TrasanTRK.nhits);
2002 double fiTerm = TrasanTRK.fiTerm;
2003
2004 double fi0 = track_rep.phi0();
2005 HepPoint3D xc(track_rep.kappa()/fabs(track_rep.kappa())*
2006 track_rep.center() );
2007 double x = xc.x();
2008 double y = xc.y();
2009 double phi_x;
2010 if( fabs( x ) > 1.0e-10 ){
2011 phi_x = atan2( y, x );
2012 if( phi_x < 0 ) phi_x += 2*M_PI;
2013 } else {
2014 phi_x = ( y > 0 ) ? M_PI_4: 3.0*M_PI_4;
2015 }
2016 if(debug_ == 4) cout<<"fiterm "<<fiTerm<<" fi0 "<<fi0<<" phi_x "<<phi_x<<endl;
2017 double dphi = fabs( fiTerm + fi0 - phi_x );
2018 if( dphi >= 2*M_PI ) dphi -= 2*M_PI;
2019 double tanl = track_rep.tanl();
2020 double cosl_inv = sqrt( tanl*tanl + 1.0 );
2021 if(debug_ == 4) {
2022 cout<<"tanl= "<<tanl<<" radius "<<track_rep.radius()<<" dphi "<<dphi<<endl;
2023 cout<<" cosl_inv "<<cosl_inv<<" radius_numf "<<track_rep.radius_numf()<<endl;
2024 }
2025 double track_len(fabs( track_rep.radius() * dphi * cosl_inv ));
2026 double light_speed( 29.9792458 ); // light speed in cm/nsec
2027 double pt( 1.0 / track_rep.kappa() );
2028 double p( pt * sqrt( 1.0 + tanl*tanl ) );
2029
2030
2031 // chisq (2 : for backward filter)
2032
2033 trk->setStat(1,1,l_mass);
2034 trk->setChisq(TrasanTRK.chiSq,1,l_mass);
2035 if(debug_ == 4) {
2036 std::cout<<".....fillTds_back...chiSq..."<< TrasanTRK.chiSq<<std::endl;
2037 std::cout<<"...track_len..."<<track_len<<" ndf[1] "<< trk->getNdf(0,l_mass)<<std::endl;
2038 }
2039 trk->setNdf(TrasanTRK.nhits-5,1,l_mass);
2040 trk->setLength(track_len,l_mass);
2041 double mass_over_p( KalFitTrack::mass(l_mass)/ p );
2042 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
2043 trk->setTof(track_len / ( light_speed * beta ), l_mass) ;
2044
2045 track_rep.pivot(IP);
2046
2047 trk->setLHelix(track_rep.a(),l_mass);
2048 trk->setLError(track_rep.Ea(),l_mass);
2049 trk->setLPivot(track.pivot(),l_mass);
2050
2051 /// right???
2052 trk->setLPoint(track.point_last(),l_mass);
2053 trk->setPathSM(track.getPathSM(),l_mass);
2054 trk->setTof(track.getTofSM(),l_mass);
2055 trk->setFiTerm(track.getFiTerm(),l_mass);
2056 trk->setTHelix(track_rep.a());
2057 trk->setTError(track_rep.Ea());
2058
2059 }
2060
2061 // test--------
2062 if(debug_ == 4) {
2063 cout<<"Now let us see results after smoothering at IP:........."<<endl;
2064 cout << " dr = " << track.a()[0]
2065 << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
2066 cout<< " phi0 = " << track.a()[1]
2067 << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
2068 cout << " PT = " << 1/track.a()[2]
2069 << ", Er_kappa = " << sqrt(track.Ea()[2][2]) << std::endl;
2070 cout << " dz = " << track.a()[3]
2071 << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
2072 cout << " tanl = " << track.a()[4]
2073 << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
2074 cout << " Ea = " << track.Ea() <<endl;
2075 }
2076 // test end ----------
2077}
void HelixSegs(vector< KalFitHelixSeg > &vs)
HelixSegRefVec getVecHelixSegs(int pid=-1) const
void setVecHelixSegs(const HelixSegRefVec &vechelixsegs, int pid=-1)

◆ fillTds_back() [4/6]

void KalFitAlg::fillTds_back ( KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol 
)

◆ fillTds_back() [5/6]

void KalFitAlg::fillTds_back ( KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol,
int  smoothflag 
)

for smoother process

right???

Definition at line 2079 of file KalFitAlg.cxx.

2082{
2083
2084 HepPoint3D IP(0,0,0);
2085
2086 // attention the pivot problem of the HelixSeg ... ???
2087 //track.pivot(IP);
2088 // Fit quality
2089 //int iqual(1);
2090 //if ((trk->getNdf(0,2))-(track.ndf_back()-5)>5)
2091 // form getNdf(0,2) to getNdf(0,1) for muon hypothesis
2092
2093 iqual_back_ = 1;
2094 if ((trk->getNdf(0,l_mass))-(track.ndf_back()-5)>5){
2095 iqual_back_ = 0;
2096 }
2097
2098 if(debug_ == 4){
2099 std::cout<< "fillTds_back> mass "<<trk->getMass(2)<<" ndf[0][l_mass] "<<trk->getNdf(0,l_mass)<<endl;
2100 std::cout<<"ndf_back "<< track.ndf_back() << " chi2_back " << track.chiSq_back()<<endl;
2101 }
2102
2103
2104 if (track.ndf_back() > 5 && track.chiSq_back() > 0 &&
2105 track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 &&
2106 track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 &&
2107 track.Ea()[4][4] > 0 && fabs(track.a()[0]) < DBL_MAX &&
2108 fabs(track.a()[1]) < DBL_MAX && fabs(track.a()[2]) < DBL_MAX &&
2109 fabs(track.a()[3]) < DBL_MAX && fabs(track.a()[4]) < DBL_MAX && iqual_front_[l_mass] && iqual_back_){
2110
2111 // chisq ( for backward filter)
2112 //std::cout<<"begin to fillTds_back track no. : "<<(++Tds_back_no)<<std::endl;
2113
2114
2115 HelixSegRefVec helixsegrefvec;
2116 for (vector<KalFitHelixSeg>::iterator it = track.HelixSegs().begin(); it!=track.HelixSegs().end();it ++)
2117 {
2118
2119 //std::cout<<" alpha of KalFitHelixSeg: "<<it->alpha()<<std::endl;
2120 //std::cout<<" doca1 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
2121
2122 it->pivot(IP);
2123
2124 //std::cout<<" doca2 of KalFitHelixSeg: "<<(it->approach(*(it->HitMdc()),false))<<std::endl;
2125
2126 RecMdcKalHelixSeg* helixseg = new RecMdcKalHelixSeg;
2127 helixseg->setResIncl(it->residual_include());
2128 helixseg->setResExcl(it->residual_exclude());
2129 if(debug_ == 4) {
2130 std::cout<<"helixseg->Res_inc ..."<<helixseg->getResIncl()<<std::endl;
2131 }
2132 // helixseg->setDrIncl(it->a_include()[0]);
2133 // helixseg->setFi0Incl(it->a_include()[1]);
2134 // helixseg->setCpaIncl(it->a_include()[2]);
2135 // helixseg->setDzIncl(it->a_include()[3]);
2136 // helixseg->setTanlIncl(it->a_include()[4]);
2137 //
2138 //
2139 // helixseg->setDrExcl(it->a_exclude()[0]);
2140 // helixseg->setFi0Excl(it->a_exclude()[1]);
2141 // helixseg->setCpaExcl(it->a_exclude()[2]);
2142 // helixseg->setDzExcl(it->a_exclude()[3]);
2143 // helixseg->setTanlExcl(it->a_exclude()[4]);
2144
2145 helixseg->setHelixIncl(it->a_include());
2146 //helixseg->setErrorIncl(it->Ea_include());
2147
2148 //Helix temp(IP, it->a(), it->Ea());
2149
2150 //std::cout<<" doca3 of KalFitHelixSeg: "<<(temp.approach(*(it->HitMdc()),false))<<std::endl;
2151
2152 helixseg->setHelixExcl(it->a_exclude());
2153 //helixseg->setErrorExcl(it->Ea_exclude());
2154 //helixseg->setLayerId(it->layer());
2155
2156 if(debug_ == 4) {
2157 std::cout<<"KalFitHelixSeg track id .."<<it->HitMdc()->rechitptr()->getTrkId()<<std::endl;
2158 std::cout<<"helixseg a: "<<it->a()<<std::endl;
2159 std::cout<<"helixseg a_excl: "<<helixseg->getHelixExcl()<<std::endl;
2160 std::cout<<"helixseg a_incl: "<<helixseg->getHelixIncl()<<std::endl;
2161
2162 std::cout<<"helixseg Ea: "<<it->Ea()<<std::endl;
2163 std::cout<<"helixseg Ea_excl: "<<helixseg->getErrorExcl()<<std::endl;
2164 std::cout<<"helixseg Ea_incl: "<<helixseg->getErrorIncl()<<std::endl;
2165
2166 std::cout<<"helixseg layer: "<<it->layer()<<std::endl;
2167 }
2168
2169
2170 helixseg->setTrackId(it->HitMdc()->rechitptr()->getTrkId());
2171 helixseg->setMdcId(it->HitMdc()->rechitptr()->getMdcId());
2172 helixseg->setFlagLR(it->HitMdc()->LR());
2173 helixseg->setTdc(it->HitMdc()->rechitptr()->getTdc());
2174 helixseg->setAdc(it->HitMdc()->rechitptr()->getAdc());
2175 helixseg->setZhit(it->HitMdc()->rechitptr()->getZhit());
2176 helixseg->setTof(it->tof());
2177 helixseg->setDocaIncl(it->doca_include());
2178 helixseg->setDocaExcl(it->doca_exclude());
2179 helixseg->setDD(it->dd());
2180 helixseg->setEntra(it->HitMdc()->rechitptr()->getEntra());
2181 helixseg->setDT(it->dt());
2182 //cout<<"setDT( "<<it->dt()<<" )"<<endl;
2183 segcol->push_back(helixseg);
2184 SmartRef<RecMdcKalHelixSeg> refhelixseg(helixseg);
2185 helixsegrefvec.push_back(refhelixseg);
2186 if(ntuple_&8){
2187 m_docaInc = helixseg -> getDocaIncl();
2188 m_docaExc = helixseg -> getDocaExcl();
2189 m_residualInc = helixseg -> getResIncl();
2190 m_residualExc = helixseg -> getResExcl();
2191 m_dd = helixseg -> getDD();
2192 m_lr = helixseg->getFlagLR();
2193 m_tdrift = helixseg -> getDT();
2194 m_layerid = helixseg -> getLayerId();
2195 m_yposition= it->HitMdc()->wire().fwd().y();
2196 m_eventNo = eventNo;
2197 StatusCode sc6 = m_nt6->write();
2198 if( sc6.isFailure() ) cout<<"Ntuple6 helixseg filling failed!"<<endl;
2199
2200 }
2201 }
2202
2203 trk->setVecHelixSegs(helixsegrefvec, l_mass);
2204 //cout<<"setVecHelixSegs with Kalman hits"<<endl;
2205 if(debug_ == 4) {
2206 std::cout<<"trk->getVecHelixSegs size..."<<(trk->getVecHelixSegs()).size()<<std::endl;
2207 }
2208 trk->setStat(0,1,l_mass);
2209 trk->setChisq(track.chiSq_back(),1,l_mass);
2210 trk->setNdf(track.ndf_back()-5,1,l_mass);
2211 // add setNhits ,maybe some problem
2212 trk->setNhits(track.ndf_back(),l_mass);
2213 if(!(track.ndf_back()==track.HelixSegs().size())) {
2214 std::cout<<"THEY ARE NOT EQUALL!!!"<<std::endl;
2215 }
2216 trk->setLength(track.pathip(),l_mass);
2217 if(debug_ == 4) {
2218 std::cout<<"l_mass "<<l_mass<<" path set as "<<track.pathip()<<endl;
2219 }
2220 trk->setTof(track.tof(),l_mass);
2222 if(l_mass == 3) trk->setTof(track.tof_kaon(),l_mass);
2223 if(l_mass == 4) trk->setTof(track.tof_proton(),l_mass);
2224 }
2225 // Path length in each MDC layer :
2226 if (pathl_)
2227 for (int i = 0; i<43; i++) {
2228 trk->setPathl(track.pathl()[i],i);
2229 }
2230 trk->setLHelix(track.a(),l_mass);
2231 trk->setLError(track.Ea(),l_mass);
2232 trk->setLPivot(track.pivot(),l_mass);
2233
2234 trk->setLPoint(track.point_last(),l_mass);
2235 trk->setPathSM(track.getPathSM(),l_mass);
2236 trk->setTof(track.getTofSM(),l_mass);
2237 trk->setFiTerm(track.getFiTerm(),l_mass);
2238 double a_trasan[5], ea_trasan[15];
2239 for( int i =0 ; i <5; i++){
2240 a_trasan[i] = TrasanTRK.helix[i];
2241 }
2242 for( int j =0 ; j <15; j++){
2243 ea_trasan[j] = TrasanTRK.helix[j];
2244 }
2245 trk->setTHelix(a_trasan);
2246 trk->setTError(ea_trasan);
2247
2248 if(4 == debug_){
2249 std::cout<<" last pivot: "<< trk->getLPivot(0)<<std::endl;
2250 std::cout<<" pathl in SM: "<< trk->getPathSM(0)<<std::endl;
2251 std::cout<<" fiTerm: "<< trk->getFiTerm(0)<<std::endl;
2252 std::cout<<" last point: "<< trk->getLPoint(0)<<std::endl;
2253 }
2254
2255 } else {
2256
2257 if(debug_) cout<<"ALARM: FillTds_back Not refit with KalFilter!!!"<<endl;
2258 // NOT refit with Kalman filter :
2259 trk->setStat(1,1,l_mass);
2260
2261 HepPoint3D piv(TrasanTRK.pivot[0],
2262 TrasanTRK.pivot[1],
2263 TrasanTRK.pivot[2]);
2264
2265 HepVector a(5);
2266 for(int i = 0; i < 5; i++)
2267 a[i] = TrasanTRK.helix[i];
2268
2269 HepSymMatrix ea(5);
2270 for(int i = 0, k = 0; i < 5; i++) {
2271 for(int j = 0; j <= i; j++) {
2272 ea[i][j] = matrixg_*TrasanTRK.error[k++];
2273 ea[j][i] = ea[i][j];
2274 }
2275 }
2276
2277 KalFitTrack track_rep(piv, a, ea, lead_,
2278 TrasanTRK.chiSq, TrasanTRK.nhits);
2279 double fiTerm = TrasanTRK.fiTerm;
2280
2281 double fi0 = track_rep.phi0();
2282 HepPoint3D xc(track_rep.kappa()/fabs(track_rep.kappa())*
2283 track_rep.center() );
2284 double x = xc.x();
2285 double y = xc.y();
2286 double phi_x;
2287 if( fabs( x ) > 1.0e-10 ){
2288 phi_x = atan2( y, x );
2289 if( phi_x < 0 ) phi_x += 2*M_PI;
2290 } else {
2291 phi_x = ( y > 0 ) ? M_PI_4: 3.0*M_PI_4;
2292 }
2293 if(debug_ == 4) cout<<"fiterm "<<fiTerm<<" fi0 "<<fi0<<" phi_x "<<phi_x<<endl;
2294 double dphi = fabs( fiTerm + fi0 - phi_x );
2295 if( dphi >= 2*M_PI ) dphi -= 2*M_PI;
2296 double tanl = track_rep.tanl();
2297 double cosl_inv = sqrt( tanl*tanl + 1.0 );
2298 if(debug_ == 4) {
2299 cout<<"tanl= "<<tanl<<" radius "<<track_rep.radius()<<" dphi "<<dphi<<endl;
2300 cout<<" cosl_inv "<<cosl_inv<<" radius_numf "<<track_rep.radius_numf()<<endl;
2301 }
2302 //double track_len(fabs( track_rep.radius() * dphi * cosl_inv ));
2303 double track_len(fabs( track_rep.radius() * fiTerm * cosl_inv )); // 2010-11-26 added by wangll
2304 //cout<<"track radius : "<<track_rep.radius()<<" "<<track.radius()<<endl;
2305 double light_speed( 29.9792458 ); // light speed in cm/nsec
2306 double pt( 1.0 / track_rep.kappa() );
2307 double p( pt * sqrt( 1.0 + tanl*tanl ) );
2308
2309
2310 // chisq (2 : for backward filter)
2311
2312 trk->setStat(1,1,l_mass);
2313 trk->setChisq(TrasanTRK.chiSq,1,l_mass);
2314 if(debug_ == 4) {
2315 std::cout<<".....fillTds_back...chiSq..."<< TrasanTRK.chiSq<<std::endl;
2316 std::cout<<"...track_len..."<<track_len<<" ndf[1] "<< trk->getNdf(0,l_mass)<<std::endl;
2317 }
2318 trk->setNdf(TrasanTRK.nhits-5,1,l_mass);
2319 trk->setLength(track_len,l_mass);
2320 double mass_over_p( KalFitTrack::mass(l_mass)/ p );
2321 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
2322 trk->setTof(track_len / ( light_speed * beta ), l_mass) ;
2323
2324 //track_rep.pivot(IP);
2325 HepPoint3D LPiovt = track_rep.x(fiTerm);
2326 track_rep.pivot(LPiovt);
2327
2328 trk->setLHelix(track_rep.a(),l_mass);
2329 trk->setLError(track_rep.Ea(),l_mass);
2330 //trk->setLPivot(track.pivot(),l_mass); // commented 2010-09-02
2331 //trk->setLPivot(IP, l_mass); // add 2010-09-02
2332 trk->setLPivot(LPiovt, l_mass); // add 2010-11-25
2333
2334 /// right???
2335 trk->setLPoint(track.point_last(),l_mass);
2336 //trk->setPathSM(track.getPathSM(),l_mass);// commented 2010-11-25 by wangll
2337 trk->setPathSM(track_len,l_mass);// added 2010-11-25 by wangll
2338 //trk->setTof(track.getTofSM(),l_mass);// commented 2010-11-25 by wangll
2339 // trk->setFiTerm(track.getFiTerm(),l_mass); // commented 2010-11-25 by wangll
2340 trk->setFiTerm(fiTerm,l_mass); // added by wangll 2010-11-25
2341 trk->setTHelix(track_rep.a());
2342 trk->setTError(track_rep.Ea());
2343
2344 /*
2345 // --- check track id by wangll 2010-08-15
2346 if(l_mass==lead_) {
2347 //cout<<" ----- bad smooth track -----"<<endl;
2348 //cout<<"l_mass = "<<l_mass<<endl;
2349 int trkId = trk->trackId();
2350 //
2351 // cout<<"track id = "<<trkId<<endl;
2352 // cout<<"THelix: "<<trk->getTHelix()<<endl;
2353 // cout<<"FHelix: "<<trk->getFHelix()<<endl;
2354 // cout<<"size of VecHelixSegs: "<<trk->getVecHelixSegs().size()<<endl;
2355 //
2356 SmartDataPtr<RecMdcTrackCol> mdcTrkCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
2357 //int nMdcTrk = mdcTrkCol.size();
2358 //cout<<"number of Mdc Tracks: "<<nMdcTrk<<endl;
2359 RecMdcTrackCol::iterator iter_mdcTrk = mdcTrkCol->begin();
2360 bool findMdcTrk = false;
2361 for(; iter_mdcTrk != mdcTrkCol->end(); iter_mdcTrk++) {
2362 if(trkId==(*iter_mdcTrk)->trackId()) {
2363 findMdcTrk = true;
2364 break;
2365 }
2366 }
2367 if(findMdcTrk) {
2368 HitRefVec mdcVecHits = (*iter_mdcTrk)->getVecHits();
2369 int nHits = mdcVecHits.size();
2370 //cout<<"number of Mdc Hits: "<<nHits<<endl;
2371 HelixSegRefVec helixsegrefvec;
2372 HitRefVec::iterator iter_mdcHit = mdcVecHits.begin();
2373 for(int iii=0; iter_mdcHit!=mdcVecHits.end(); iter_mdcHit++,iii++) {
2374 RecMdcKalHelixSeg* helixseg = new RecMdcKalHelixSeg;
2375 //cout<<"hit "<<iii<<endl;
2376 //cout<<"getMdcId: "<<(*iter_mdcHit)->getMdcId()<<endl;
2377 //cout<<"getAdc: "<<(*iter_mdcHit)->getAdc()<<endl;
2378 //cout<<"getTdc: "<<(*iter_mdcHit)->getTdc()<<endl;
2379 //cout<<"getDriftT: "<<(*iter_mdcHit)->getDriftT()<<endl;
2380 //cout<<"getZhit: "<<(*iter_mdcHit)->getZhit()<<endl;
2381 //cout<<"getFlagLR: "<<(*iter_mdcHit)->getFlagLR()<<endl;
2382 //cout<<"getDriftDistLeft: "<<(*iter_mdcHit)->getDriftDistLeft()<<endl;
2383 //cout<<"getDriftDistRight: "<<(*iter_mdcHit)->getDriftDistRight()<<endl;
2384 //cout<<"getDoca: "<<(*iter_mdcHit)->getDoca()<<endl;
2385 //cout<<"getEntra: "<<(*iter_mdcHit)->getEntra()<<endl;
2386 //
2387 helixseg->setMdcId((*iter_mdcHit)->getMdcId());
2388 helixseg->setAdc((*iter_mdcHit)->getAdc());
2389 helixseg->setTdc((*iter_mdcHit)->getTdc());
2390 helixseg->setZhit((*iter_mdcHit)->getZhit());
2391 helixseg->setFlagLR((*iter_mdcHit)->getFlagLR());
2392 if((*iter_mdcHit)->getFlagLR()==0) helixseg->setDD((*iter_mdcHit)->getDriftDistLeft());
2393 if((*iter_mdcHit)->getFlagLR()==1) helixseg->setDD((*iter_mdcHit)->getDriftDistRight());
2394 helixseg->setDocaIncl((*iter_mdcHit)->getDoca());
2395 helixseg->setEntra((*iter_mdcHit)->getEntra());
2396 helixseg->setDT((*iter_mdcHit)->getDriftT());
2397 segcol->push_back(helixseg);
2398 SmartRef<RecMdcKalHelixSeg> refhelixseg(helixseg);
2399 helixsegrefvec.push_back(refhelixseg);
2400 }
2401 trk->setVecHelixSegs(helixsegrefvec);
2402 cout<<"setVecHelixSegs with Mdc hits"<<endl;
2403 }
2404 else cout<<"not find the Mdc Track!";
2405 //cout<<"size of VecHelixSegs: "<<trk->getVecHelixSegs().size()<<endl;
2406 }
2407 */
2408
2409 }
2410
2411 // test--------
2412 if(debug_ == 4) {
2413 cout<<"Now let us see results after smoothering at IP:........."<<endl;
2414 cout << " dr = " << track.a()[0]
2415 << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
2416 cout<< " phi0 = " << track.a()[1]
2417 << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
2418 cout << " PT = " << 1/track.a()[2]
2419 << ", Er_kappa = " << sqrt(track.Ea()[2][2]) << std::endl;
2420 cout << " dz = " << track.a()[3]
2421 << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
2422 cout << " tanl = " << track.a()[4]
2423 << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
2424 cout << " Ea = " << track.Ea() <<endl;
2425 }
2426 // test end ----------
2427}

◆ fillTds_back() [6/6]

void KalFitAlg::fillTds_back ( KalFitTrack track,
RecMdcKalTrack trk,
MdcRec_trk TrasanTRK,
int  l_mass,
RecMdcKalHelixSegCol segcol,
int  smoothflag 
)

for smoother process

◆ fillTds_ip() [1/2]

void KalFitAlg::fillTds_ip ( MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass 
)

with results got at (0,0,0)

Definition at line 1503 of file KalFitAlg.cxx.

1505{
1506 HepPoint3D IP(0,0,0);
1507 track.pivot(IP);
1508
1509 if (debug_ == 4&& l_mass==lead_) {
1510 cout << "fillTds_IP>......"<<endl;
1511 cout << " dr = " << track.a()[0]
1512 << ", Er_dr = " << sqrt(track.Ea()[0][0]) << std::endl;
1513 cout << " phi0 = " << track.a()[1]
1514 << ", Er_phi0 = " << sqrt(track.Ea()[1][1]) << std::endl;
1515 cout << " PT = " << 1/track.a()[2]
1516 << ", Er_kappa =" << sqrt(track.Ea()[2][2]) << std::endl;
1517 cout << " dz = " << track.a()[3]
1518 << ", Er_dz = " << sqrt(track.Ea()[3][3]) << std::endl;
1519 cout << " tanl = " << track.a()[4]
1520 << ", Er_tanl = " << sqrt(track.Ea()[4][4]) << std::endl;
1521 }
1522
1523 if (TrasanTRK.nhits-track.nchits()>fitnocut_ ||
1524 TrasanTRK.helix[2]*track.a()[2]<0)
1525 iqual_front_[l_mass] = 0;
1526
1527
1528 if (track.nchits() > 5 && track.nster() > 1 &&
1529 track.nchits()-track.nster() > 2 && track.chiSq() > 0 &&
1530 track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 &&
1531 track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 &&
1532 track.Ea()[4][4] > 0 && iqual_front_[l_mass]) {
1533
1534 // fill track information
1535 double dr = track.a()[0];
1536 double phi0 = track.a()[1];
1537 double kappa = track.a()[2];
1538 double dz = track.a()[3];
1539 double tanl = track.a()[4];
1540
1541 // vertex of the track
1542 double vx = dr*cos(phi0);
1543 double vy = dr*sin(phi0);
1544 double vz = dz;
1545
1546 // see Belle note148 for the formulas
1547 // initial momentum of the track
1548 if(0==kappa) kappa = 10e-10;
1549 double px = -sin(phi0)/fabs(kappa);
1550 double py = cos(phi0)/fabs(kappa);
1551 double pz = tanl/fabs(kappa);
1552
1553 trk->setX(vx, l_mass);
1554 trk->setY(vy, l_mass);
1555 trk->setZ(vz, l_mass);
1556 trk->setPx(px, l_mass);
1557 trk->setPy(py, l_mass);
1558 trk->setPz(pz, l_mass);
1559
1560 const HepPoint3D poca(dr*cos(phi0),dr*sin(phi0),dz);
1561 trk->setPoca(poca,l_mass);
1562
1563 trk->setZHelix(track.a(),l_mass);
1564 trk->setZError(track.Ea(),l_mass);
1565
1566
1567 //set charge
1568 int charge=0;
1569 if (kappa > 0.0000000001)
1570 charge = 1;
1571 else if (kappa < -0.0000000001)
1572 charge = -1;
1573 trk->setCharge(charge,l_mass);
1574
1575 //set theta
1576 double ptot = sqrt(px*px+py*py+pz*pz);
1577 trk->setTheta(acos(pz/ptot),l_mass);
1578 }
1579
1580 else{
1581 //cout<<"copy Mdc Helix in fillTds_ip()"<<endl;
1582
1583 // fill track information
1584 double dr = TrasanTRK.helix[0];
1585 double phi0 = TrasanTRK.helix[1];
1586 double kappa = TrasanTRK.helix[2];
1587 double dz = TrasanTRK.helix[3];
1588 double tanl = TrasanTRK.helix[4];
1589
1590 double vx = dr*cos(phi0);
1591 double vy = dr*sin(phi0);
1592 double vz = dz;
1593
1594 if(0==kappa) kappa = 10e-10;
1595 double px = -sin(phi0)/fabs(kappa);
1596 double py = cos(phi0)/fabs(kappa);
1597 double pz = tanl/fabs(kappa);
1598
1599 trk->setX(vx, l_mass);
1600 trk->setY(vy, l_mass);
1601 trk->setZ(vz, l_mass);
1602
1603 trk->setPx(px, l_mass);
1604 trk->setPy(py, l_mass);
1605 trk->setPz(pz, l_mass);
1606
1607 const HepPoint3D poca(dr*cos(phi0),dr*sin(phi0),dz);
1608
1609 trk->setPoca(poca,l_mass);
1610 //trk->setZHelix(TrasanTRK.helix,l_mass);
1611 //trk->setZError(TrasanTRK.error,l_mass);
1612 double a_trasan[5], ea_trasan[15];
1613 for( int i =0 ; i <5; i++){
1614 a_trasan[i] = TrasanTRK.helix[i];
1615 }
1616 for( int j =0 ; j <15; j++){
1617 ea_trasan[j] = TrasanTRK.error[j];
1618 }
1619 trk->setZHelix(a_trasan,l_mass);
1620 trk->setZError(ea_trasan,l_mass);
1621
1622 //set charge
1623 int charge=0;
1624 if (kappa > 0.0000000001)
1625 charge = 1;
1626 else if (kappa < -0.0000000001)
1627 charge = -1;
1628 trk->setCharge(charge,l_mass);
1629
1630 //set theta
1631 double ptot = sqrt(px*px+py*py+pz*pz);
1632 trk->setTheta(acos(pz/ptot),l_mass);
1633 }
1634
1635 if(4==debug_) {
1637 std::cout<<"px: "<<trk->px()<<" py: "<<trk->py()<<" pz: "<<trk->pz()<<std::endl;
1638 std::cout<<"vx: "<<trk->x()<<" vy: "<<trk->y()<<" vz: "<<trk->z()<<std::endl;
1639 }
1640}
double sin(const BesAngle a)
double cos(const BesAngle a)
void setZError(const HepSymMatrix &error, const int pid)
void setPoca(const HepPoint3D &poca, const int pid)
void setTheta(const double theta, const int pid)
void setZHelix(const HepVector &helix, const int pid)
void setCharge(const int charge, const int pid)

Referenced by complete_track().

◆ fillTds_ip() [2/2]

void KalFitAlg::fillTds_ip ( MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass 
)

with results got at (0,0,0)

◆ fillTds_lead() [1/2]

void KalFitAlg::fillTds_lead ( MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass 
)

Definition at line 1411 of file KalFitAlg.cxx.

1412 {
1413
1414 HepPoint3D IP(0,0,0);
1415 track.pivot(IP);
1416 // Fit quality
1417 // int iqual(1);
1418 int trasster = TrasanTRK.nster, trakster = track.nster(),
1419 trasax(TrasanTRK.nhits-trasster), trakax(track.nchits()-trakster);
1420 if (TrasanTRK.nhits-track.nchits()>fitnocut_ ||
1421 TrasanTRK.helix[2]*track.a()[2]<0)
1422 iqual_front_[l_mass] = 0;
1423 if (debug_ == 4) {
1424
1425 cout<<"Nhit from PR "<<TrasanTRK.nhits<<" nhit "<<track.nchits()<<endl;
1426 cout<< "trasster trakster trasax trakax TrasK trackK iqual"<<endl
1427 <<trasster<<" "<<trakster<<" "<<trasax<<" "<<trakax
1428 <<" "<<TrasanTRK.helix[2]<<" "<<track.a()[2]<<" "<<iqual_front_[l_mass]<<endl;
1429 cout<<"FillTds_lead> track.chiSq..."<<track.chiSq()<<" nchits "<<track.nchits()
1430 <<" nster "<<track.nster()<<" iqual_front_[l_mass] "<<iqual_front_[l_mass]<<" track.Ea "<<track.Ea()<<endl;
1431
1432 cout << " TRASAN stereo = " << trasster
1433 << " and KalFitTrack = " << trakster << std::endl;
1434 cout << " TRASAN axial = " << trasax
1435 << " and KalFitTrack = " << trakax << std::endl;
1436
1437 if (!iqual_front_[l_mass]) {
1438 cout << "...there is a problem during fit !! " << std::endl;
1439 if (trasster-trakster>5)
1440 cout << " because stereo " << trasster-trakster << std::endl;
1441 if (trasax-trakax >5)
1442 cout << " because axial " << std::endl;
1443 if (TrasanTRK.helix[2]*track.a()[2]<0)
1444 cout << " because kappa sign " << std::endl;
1445 }
1446 }
1447 // Protection : if any problem, we keep the original information !!!!
1448 if (track.nchits() > 5 && track.nster() > 1 &&
1449 track.nchits()-track.nster() > 2 && track.chiSq() > 0 &&
1450 track.Ea()[0][0] > 0 && track.Ea()[1][1] > 0 &&
1451 track.Ea()[2][2] > 0 && track.Ea()[3][3] > 0 &&
1452 track.Ea()[4][4] > 0 && iqual_front_[l_mass]) {
1453
1454 trk->setStat(0,0,l_mass);
1455 trk->setMass(track.mass(),l_mass);
1456 trk->setChisq(track.chiSq(),0,l_mass);
1457 trk->setNdf(track.nchits()-5,0,l_mass);
1458 trk->setNhits(track.nchits(),l_mass);
1459 //trkid
1460 trk->setTrackId(TrasanTRK.id);
1461
1462 if (debug_ == 4) cout<<" trasan id...1 "<<TrasanTRK.id<<endl;
1463
1464 trk->setFHelix(track.a(),l_mass);
1465 trk->setFError(track.Ea(),l_mass);
1466
1467 } else {
1468
1469 //cout<<"copy Mdc Helix in fillTds_lead()"<<endl;
1470
1471 if(debug_) cout<<"ALARM: FillTds_forMdc Not refit with KalFilter!!!"<<endl;
1472 // NOT refit with Kalman filter :
1473 trk->setStat(1,0,l_mass);
1474 trk->setMass(KalFitTrack::mass(l_mass),l_mass);
1475
1476 // chisq & ndf
1477 trk->setChisq(TrasanTRK.chiSq,0,l_mass);
1478 trk->setNdf(TrasanTRK.nhits-5,0,l_mass);
1479 //trkid
1480 trk->setTrackId(TrasanTRK.id);
1481
1482 if (debug_ ==4) cout<<" trasan id...2 "<<TrasanTRK.id<<endl;
1483
1484 // nhits
1485 trk->setNhits(TrasanTRK.nhits,l_mass);
1486 double a_trasan[5], ea_trasan[15];
1487 for( int i =0 ; i <5; i++){
1488 a_trasan[i] = TrasanTRK.helix[i];
1489 }
1490 for( int j =0 ; j <15; j++){
1491 ea_trasan[j] = TrasanTRK.error[j];
1492 }
1493 trk->setFHelix(a_trasan,l_mass);
1494 trk->setFError(ea_trasan,l_mass);
1495 // trk->setFHelix(TrasanTRK.helix,l_mass);
1496 // trk->setFError(TrasanTRK.error,l_mass);
1497 }
1498}

Referenced by complete_track().

◆ fillTds_lead() [2/2]

void KalFitAlg::fillTds_lead ( MdcRec_trk TrasanTRK,
KalFitTrack track,
RecMdcKalTrack trk,
int  l_mass 
)

◆ filter_fwd_anal() [1/2]

void KalFitAlg::filter_fwd_anal ( KalFitTrack trk,
int  l_mass,
int  way,
HepSymMatrix &  Eakal 
)

Kalman filter (forward) in Mdc.

get the doca from another other independent method

Definition at line 2803 of file KalFitAlg.cxx.

2804{
2805
2806 //cout<<"**********************"<<endl;//wangll
2807 //cout<<"filter pid type "<<l_mass<<endl;//wangll
2808 // retrieve Mdc geometry information
2809
2810 IMdcGeomSvc* igeomsvc;
2811 StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
2812 if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl;
2813 MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
2814 if(!geomsvc){
2815 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
2816 }
2817
2818 Hep3Vector x0inner(track.pivot());
2819 HepVector pos_old(3,0);
2820 double r0kal_prec(0);
2821 int nhits_read(0);
2822 int nhit = track.HitsMdc().size();
2823 if(debug_ == 4) cout<<"filter_fwd..........111 nhit="<<nhit<<endl;
2824 for( int i=0 ; i < nhit; i++ ) {
2825 KalFitHitMdc& HitMdc = track.HitMdc(i);
2826 // veto on some hits :
2827 if (HitMdc.chi2()<0) continue;
2828 const KalFitWire& Wire = HitMdc.wire();
2829 int layerf = Wire.layer().layerId();
2830
2831 //std::cout<<"in layer: "<<layerf<<std::endl;
2832
2833 int wireid = Wire.geoID();
2834 nhits_read++;
2835 HepPoint3D fwd(Wire.fwd());
2836 HepPoint3D bck(Wire.bck());
2837 Hep3Vector wire = (CLHEP::Hep3Vector)fwd -(CLHEP::Hep3Vector)bck;
2838 Helix work = *(Helix*)&track;
2839 work.ignoreErrorMatrix();
2840 work.pivot((fwd + bck) * .5);
2841
2842 //std::cout<<" (fwd + bck) * .5: "<<(fwd + bck)*.5<<std::endl;
2843 //std::cout<<" track.x(0): "<<track.x(0)<<std::endl;
2844 //std::cout<<" work.x(0): "<<work.x(0)<<std::endl;
2845 //std::cout<<" bck: "<<bck<<std::endl;
2846
2847 HepPoint3D x0kal = (work.x(0).z() - bck.z())/ wire.z() * wire + bck;
2848
2849 if(4 == debug_) std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
2850
2851 // Modification to take account of the wire sag :
2852 /*
2853 if (wsag_==1) {
2854 double A(1.2402E-6);
2855 if (nhits_read != 1 && r0kal_prec > RMW && x0kal.perp() < RMW)
2856 A = 8.5265E-7;
2857 HepPoint3D x0kal_up(x0kal);
2858 double length = sqrt(wire.x()*wire.x()+wire.z()*wire.z());
2859 double zp = (x0kal.z() - bck.z())*length/wire.z();
2860
2861 x0kal_up.setX(wire.x()*(x0kal.z()-bck.z())/wire.z()+bck.x());
2862 x0kal_up.setY((A*(zp-length)+wire.y()/length)*zp+bck.y());
2863 double slopex = wire.x()/wire.z();
2864 double slopey = (A*(2*zp-length)*length+wire.y())/wire.z();
2865
2866 x0kal = x0kal_up;
2867 wire.setX(slopex);
2868 wire.setY(slopey);
2869 wire.setZ(1);
2870
2871 } else if (wsag_ == 2 || wsag_ == 3){
2872 double slopex = wire.x()/wire.z();
2873 double slopey(0), zinit(x0kal.z());
2874 double pos[3], yb_sag(0), yf_sag(0);
2875 int wire_ID = Wire.geoID();
2876 if (wsag_ == 2)
2877 calcdc_sag2_(&wire_ID, &zinit, pos, &slopey, &yb_sag, &yf_sag);
2878
2879 else
2880 calcdc_sag3_(&wire_ID, &zinit, pos, &slopey, &yb_sag, &yf_sag);
2881
2882 wire.setX(slopex);
2883 wire.setY(slopey);
2884 wire.setZ(1);
2885 x0kal.setX(pos[0]);
2886 x0kal.setY(pos[1]);
2887 } else
2888 */
2889
2890 if (wsag_ == 4){
2891 Hep3Vector result;
2892 const MdcGeoWire* geowire = geomsvc->Wire(wireid);
2893 double tension = geowire->Tension();
2894 //std::cout<<" tension: "<<tension<<std::endl;
2895 double zinit(x0kal.z()), lzx(Wire.lzx());
2896 // double A(Wire.Acoef());
2897 double A = 47.35E-6/tension;
2898 double Zp = (zinit - bck.z())*lzx/wire.z();
2899
2900 if(4 == debug_){
2901 std::cout<<" sag in filter_fwd_anal: "<<std::endl;
2902 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
2903 std::cout<<"zinit: "<<zinit<<" bck.z(): "<<bck.z()<<std::endl;
2904 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
2905 <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;
2906 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
2907 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
2908 <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
2909 }
2910
2911 result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
2912 result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
2913 result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
2914
2915 wire.setX(wire.x()/wire.z());
2916 wire.setY(result.z());
2917 wire.setZ(1);
2918 x0kal.setX(result.x());
2919 x0kal.setY(result.y());
2920 }
2921
2922 if(4 == debug_) std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
2923
2924 // If x0kal is after the inner wall and x0kal_prec before :
2925 double r0kal = x0kal.perp();
2926
2927 // change PIVOT :
2928 double pathl(0);
2929
2930 track.pivot_numf(x0kal, pathl);
2931
2932 if (nhits_read == 1) {
2933 track.Ea(Eakal);
2934 } else {
2935 if(KalFitElement::muls()) track.msgasmdc(pathl, way);
2936 if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
2937 }
2938
2939 double dtracknew = 0.;
2940 double dtrack = 0.;
2941 double dtdc = 0.;
2942 // Add info hit wire :
2943 if(fabs(track.kappa())>0&&fabs(track.kappa())<1000.0&&fabs(track.tanl())<7.02) {
2944 Hep3Vector meas = track.momentum(0).cross(wire).unit();
2945 double diff_chi2 = track.chiSq();
2946 Hep3Vector IP(0,0,0);
2947 Helix work_bef = *(Helix*)&track;
2948 work_bef.ignoreErrorMatrix();
2949 work_bef.pivot(IP);
2950 int inext(-1);
2951 if (i+1<nhit)
2952 for( unsigned k=i+1 ; k < nhit; k++ )
2953 if (!(track.HitMdc(k).chi2()<0)) {
2954 inext = (signed) k;
2955 break;
2956 }
2957 double dchi2 = -1.0;
2958
2959 double chi2 = track.update_hits(HitMdc,inext,meas,way,dchi2,dtrack,dtracknew,dtdc,m_csmflag);
2960
2961 //cout << "dchi2=" << dchi2 << endl;
2962 /// get the doca from another other independent method
2963
2964 /*
2965 std::cout<<" step0: "<<std::endl;
2966 KalFitTrack temp2(track);
2967 std::cout<<" step1: "<<std::endl;
2968
2969 Helix temp3(track.pivot(),track.a(),track.Ea());
2970 Helix temp4(track.pivot(),track.a(),track.Ea());
2971
2972 std::cout<<" step2: "<<std::endl;
2973 double doca25 = temp2.approach(HitMdc, false);
2974 std::cout<<" step3: "<<std::endl;
2975
2976 temp2.pivot(IP);
2977 std::cout<<" a2: "<<temp2.a()<<std::endl;
2978
2979 std::cout<<" step4: "<<std::endl;
2980
2981 double doca26 = temp3.approach(HitMdc, false);
2982 std::cout<<" another doca2.6: "<<doca26<<std::endl;
2983
2984 temp3.pivot(IP);
2985 std::cout<<" a3: "<<temp3.a()<<std::endl;
2986
2987 temp4.bFieldZ(-10);
2988 temp4.pivot(IP);
2989 std::cout<<" a4: "<<temp4.a()<<std::endl;
2990
2991 std::cout<<" step5: "<<std::endl;
2992
2993 double doca1 = track.approach(HitMdc, false);
2994 double doca2 = temp2.approach(HitMdc, false);
2995 double doca3 = temp3.approach(HitMdc, false);
2996 double doca4 = temp4.approach(HitMdc, false);
2997
2998 std::cout<<" dtrack: "<<dtrack<<std::endl;
2999 std::cout<<" another doca1: "<<doca1<<std::endl;
3000 std::cout<<" another doca2: "<<doca2<<std::endl;
3001 std::cout<<" another doca2.5: "<<doca25<<std::endl;
3002 std::cout<<" another doca3: "<<doca3<<std::endl;
3003 std::cout<<" another doca4: "<<doca4<<std::endl;
3004 */
3005
3006
3007 if( dchi2 <0 ) {
3008 std::cout<<" ... ERROR OF dchi2... "<<std::endl;
3009 }
3010
3011 if (ntuple_&8) {
3012 m_dchi2 = dchi2;
3013 m_masshyp = l_mass;
3014 m_residest = dtrack-dtdc;
3015 m_residnew = dtracknew -dtdc;
3016 m_layer = Wire.layer().layerId();
3017 Helix worktemp = *(Helix*)&track;
3018 m_anal_dr = worktemp.a()[0];
3019 m_anal_phi0 = worktemp.a()[1];
3020 m_anal_kappa = worktemp.a()[2];
3021 m_anal_dz = worktemp.a()[3];
3022 m_anal_tanl = worktemp.a()[4];
3023 m_anal_ea_dr = worktemp.Ea()[0][0];
3024 m_anal_ea_phi0 = worktemp.Ea()[1][1];
3025 m_anal_ea_kappa = worktemp.Ea()[2][2];
3026 m_anal_ea_dz = worktemp.Ea()[3][3];
3027 m_anal_ea_tanl = worktemp.Ea()[4][4];
3028 StatusCode sc5 = m_nt5->write();
3029 if( sc5.isFailure() ) cout<<"Ntuple5 filling failed!"<<endl;
3030 }
3031 Helix work_aft = *(Helix*)&track;
3032 work_aft.ignoreErrorMatrix();
3033 work_aft.pivot(IP);
3034 diff_chi2 = chi2 - diff_chi2;
3035 HitMdc.chi2(diff_chi2);
3036 }
3037 r0kal_prec = r0kal;
3038 }
3039 //cout <<"filter end" << endl;
3040}
const int layerId(void) const
returns layer ID
HepPoint3D fwd(void) const
Geometry :
const KalFitLayer_Mdc & layer(void) const
void ignoreErrorMatrix(void)
unsets error matrix. Error calculations will be ignored after this function call until an error matri...

Referenced by complete_track(), kalman_fitting_anal(), and start_seed().

◆ filter_fwd_anal() [2/2]

void KalFitAlg::filter_fwd_anal ( KalFitTrack trk,
int  l_mass,
int  way,
HepSymMatrix &  Eakal 
)

Kalman filter (forward) in Mdc.

◆ filter_fwd_calib() [1/2]

void KalFitAlg::filter_fwd_calib ( KalFitTrack trk,
int  l_mass,
int  way,
HepSymMatrix &  Eakal 
)

Definition at line 3044 of file KalFitAlg.cxx.

3045{
3046
3047 // retrieve Mdc geometry information
3048 IMdcGeomSvc* igeomsvc;
3049 StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
3050 if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl;
3051 MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
3052 if(!geomsvc){
3053 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
3054 }
3055
3056 if(debug_ == 4) {
3057 std::cout<<"filter_fwd_calib starting ...the inital error Matirx is "<<track.Ea()<<std::endl;
3058 }
3059 Hep3Vector x0inner(track.pivot());
3060 HepVector pos_old(3,0);
3061 double r0kal_prec(0);
3062 int nhits_read(0);
3063
3064 unsigned int nhit = track.HitsMdc().size();
3065 if(debug_ == 4) cout<<"filter_fwd..........111 nhit="<<nhit<<endl;
3066 for( unsigned i=0 ; i < nhit; i++ ) {
3067
3068 KalFitHitMdc& HitMdc = track.HitMdc(i);
3069 if(debug_ == 4)
3070 cout<<"filter_fwd...........222 chi2="<<HitMdc.chi2()<<endl;
3071 // veto on some hits :
3072 if (HitMdc.chi2()<0) continue;
3073 const KalFitWire& Wire = HitMdc.wire();
3074
3075 int wireid = Wire.geoID();
3076 nhits_read++;
3077
3078 // if (nhits_read == 1) track.Ea(Eakal);
3079 HepPoint3D fwd(Wire.fwd());
3080 HepPoint3D bck(Wire.bck());
3081 Hep3Vector wire = (CLHEP::Hep3Vector)fwd -(CLHEP::Hep3Vector)bck;
3082 Helix work = *(Helix*)&track;
3083 work.ignoreErrorMatrix();
3084 work.pivot((fwd + bck) * .5);
3085 HepPoint3D x0kal = (work.x(0).z() - bck.z())/ wire.z() * wire + bck;
3086
3087 if(4 == debug_)
3088 std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
3089
3090 if (wsag_ == 4){
3091 Hep3Vector result;
3092 const MdcGeoWire* geowire = geomsvc->Wire(wireid);
3093 double tension = geowire->Tension();
3094 //std::cout<<" tension: "<<tension<<std::endl;
3095 double zinit(x0kal.z()), lzx(Wire.lzx());
3096 // double A(Wire.Acoef());
3097 double A = 47.35E-6/tension;
3098 double Zp = (zinit - bck.z())*lzx/wire.z();
3099
3100 if(4 == debug_){
3101
3102 std::cout<<" sag in filter_fwd_calib: "<<std::endl;
3103 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
3104 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
3105 <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;
3106 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
3107 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
3108 <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
3109 }
3110
3111 result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
3112 result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
3113 result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
3114 wire.setX(wire.x()/wire.z());
3115 wire.setY(result.z());
3116 wire.setZ(1);
3117 x0kal.setX(result.x());
3118 x0kal.setY(result.y());
3119 }
3120
3121 if(4 == debug_)
3122 std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
3123
3124 // If x0kal is after the inner wall and x0kal_prec before :
3125 double r0kal = x0kal.perp();
3126
3127 // change PIVOT :
3128 double pathl(0);
3129
3130 //std::cout<<" track a3: "<<track.a()<<std::endl;
3131 //std::cout<<" track p3: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
3132
3133 if (debug_ == 4)
3134 cout << "*** move from " << track.pivot() << " ( Kappa = "
3135 << track.a()[2] << ")" << endl;
3136 track.pivot_numf(x0kal, pathl); //see the code , the error matrix has been changed in this function ..
3137
3138 //std::cout<<" track a4: "<<track.a()<<std::endl;
3139 //std::cout<<" track p4: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
3140
3141
3142 if (debug_ == 4)
3143 cout << "*** to " << track.pivot() << " ( Kappa = "
3144 << track.a()[2] << ")" << std::endl;
3145
3146 if (nhits_read == 1) {
3147 track.Ea(Eakal);
3148 if(debug_==4) cout << "filter_fwd::Ea = " << track.Ea()<<endl;
3149
3150
3151 } else {
3152 if(KalFitElement::muls()) track.msgasmdc(pathl, way);
3153 if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
3154 }
3155
3156
3157 //std::cout<<" track a5: "<<track.a()<<std::endl;
3158 //std::cout<<" track p5: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
3159
3160 // Add info hit wire :
3161 if(fabs(track.kappa())>0&&fabs(track.kappa())<1000.0&&fabs(track.tanl())<7.02) {
3162 Hep3Vector meas = track.momentum(0).cross(wire).unit();
3163
3164 double diff_chi2 = track.chiSq();
3165
3166 Hep3Vector IP(0,0,0);
3167 Helix work_bef = *(Helix*)&track;
3168 work_bef.ignoreErrorMatrix();
3169 work_bef.pivot(IP);
3170 int inext(-1);
3171 if (i+1<nhit)
3172 for( unsigned k=i+1 ; k < nhit; k++ )
3173 if (!(track.HitMdc(k).chi2()<0)) {
3174 inext = (signed) k;
3175 break;
3176 }
3177 double dchi2 = -1.0;
3178
3179 if (debug_ == 4) {
3180 std::cout<<"the value of x0kal is "<<x0kal<<std::endl;
3181 std::cout<<"the value of track.pivot() is "<<track.pivot()<<std::endl;
3182 }
3183
3184 HepVector Va(5,0);
3185 HepSymMatrix Ma(5,0);
3186 KalFitHelixSeg HelixSeg(&HitMdc,x0kal,Va,Ma);
3187
3188 if(debug_ == 4) {
3189 std::cout<<"HelixSeg.Ea_pre_fwd() ..."<<HelixSeg.Ea_pre_fwd()<<std::endl;
3190 std::cout<<"HelixSeg.a_pre_fwd() ..."<<HelixSeg.a_pre_fwd()<<std::endl;
3191 std::cout<<"HelixSeg.Ea_filt_fwd() ..."<<HelixSeg.Ea_filt_fwd()<<std::endl;
3192 }
3193
3194 //std::cout<<" track a1: "<<track.a()<<std::endl;
3195 //std::cout<<" track p1: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
3196
3197 double chi2=0.;
3198 if(usage_>1) chi2=track.update_hits_csmalign(HelixSeg, inext, meas, way, dchi2, m_csmflag);
3199 else chi2 = track.update_hits(HelixSeg, inext, meas, way, dchi2, m_csmflag);
3200
3201 //std::cout<<" track a2: "<<track.a()<<std::endl;
3202 //std::cout<<" track p2: "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<std::endl;
3203
3204 if(debug_ ==4 ) cout<<"layer, cell, dchi2,chi2, a, p: "<<HitMdc.wire().layer().layerId()<<" , "<<HitMdc.wire().localId()<<" , "<<dchi2<<" , "<<chi2<<" , "<<track.a()<<" , "<<sqrt(1.0+track.a()[4]*track.a()[4])/track.a()[2]<<endl;
3205
3206 if(debug_ == 4) cout<< "****inext***"<<inext<<" !!!! dchi2= "<< dchi2
3207 << " chisq= "<< chi2<< endl;
3208
3209 if (ntuple_&8) {
3210 m_dchi2 = dchi2;
3211 m_masshyp = l_mass;
3212 StatusCode sc5 = m_nt5->write();
3213 if( sc5.isFailure() ) cout<<"Ntuple5 filling failed!"<<endl;
3214 }
3215
3216 Helix work_aft = *(Helix*)&track;
3217 work_aft.ignoreErrorMatrix();
3218 work_aft.pivot(IP);
3219 diff_chi2 = chi2 - diff_chi2;
3220 HitMdc.chi2(diff_chi2);
3221
3222 if(debug_ == 4) {
3223
3224 cout << " -> after include meas = " << meas
3225 << " at R = " << track.pivot().perp() << std::endl;
3226 cout << " chi2 = " << chi2 << ", diff_chi2 = "
3227 << diff_chi2 << ", LR = "
3228 << HitMdc.LR() << ", stereo = " << HitMdc.wire().stereo()
3229 << ", layer = " << HitMdc.wire().layer().layerId() << std::endl;
3230 cout<<"filter_fwd..........HitMdc.chi2... "<<HitMdc.chi2()<<endl;
3231 }
3232
3233 if(dchi2>0.0 && (way!=999)) {
3234 track.HelixSegs().push_back(HelixSeg);
3235 }
3236 }
3237 r0kal_prec = r0kal;
3238 }
3239}
unsigned int localId(void) const
Extractor :

Referenced by complete_track(), kalman_fitting_calib(), kalman_fitting_csmalign(), kalman_fitting_MdcxReco_Csmc_Sew(), and start_seed().

◆ filter_fwd_calib() [2/2]

void KalFitAlg::filter_fwd_calib ( KalFitTrack trk,
int  l_mass,
int  way,
HepSymMatrix &  Eakal 
)

◆ finalize() [1/2]

StatusCode KalFitAlg::finalize ( )

Definition at line 320 of file KalFitAlg.cxx.

321{
322 MsgStream log(msgSvc(), name());
323 log << MSG::DEBUG<<"KalFitAlg:: nTotalTrks = "<<nTotalTrks<<endreq;
324 log << MSG::DEBUG<<" e: "<<nFailedTrks[0]<<" failed, "<<nTotalTrks-nFailedTrks[0]<<" successed"<<endreq;
325 log << MSG::DEBUG<<" mu: "<<nFailedTrks[1]<<" failed, "<<nTotalTrks-nFailedTrks[1]<<" successed"<<endreq;
326 log << MSG::DEBUG<<" pi: "<<nFailedTrks[2]<<" failed, "<<nTotalTrks-nFailedTrks[2]<<" successed"<<endreq;
327 log << MSG::DEBUG<<" K: "<<nFailedTrks[3]<<" failed, "<<nTotalTrks-nFailedTrks[3]<<" successed"<<endreq;
328 log << MSG::DEBUG<<" p: "<<nFailedTrks[4]<<" failed, "<<nTotalTrks-nFailedTrks[4]<<" successed"<<endreq;
329 return StatusCode::SUCCESS;
330}

◆ finalize() [2/2]

StatusCode KalFitAlg::finalize ( )

◆ fitGemHits() [1/2]

void KalFitAlg::fitGemHits ( KalFitTrack track,
int  hypo,
int  way 
)

Definition at line 6843 of file KalFitAlg.cxx.

6844{
6845 {
6846 //cout<<endl;
6847 //cout<<"--------------------------------------"<<endl;
6848 //cout<<"start GEM Kalman fit: hypo = "<<hypo<<endl;
6849 //cout<<"--------------------------------------"<<endl;
6850 // std::vector<double> dchi2_all;
6851 // std::vector<HepPoint3D> posnew;
6852 // std::vector<HepSymMatrix> eanew;
6853 // std::vector<HepVector> anew;
6854 //std::map<int,double> dchi2;
6855 std::map<double,double> esti1_r;
6856 std::map<double,double> esti2_r;
6857 std::map<double,double> esti1_phi;
6858 std::map<double,double> esti2_phi;
6859 std::map<double,double> esti1_z;
6860 std::map<double,double> esti2_z;
6861 std::map<double,double> diff1_phi;
6862 std::map<double,double> diff1_z;
6863 std::map<double,double> diff2_phi;
6864 std::map<double,double> diff2_z;
6865 std::map<double,HepPoint3D> posnew;
6866 std::map<double,HepSymMatrix> eanew;
6867 std::map<double,HepVector> anew;
6868 std::map<double,double> meas_r;
6869 std::map<double,double> meas_phi;
6870 std::map<double,double> meas_z;
6871 std::map<double,double> meas_phierr;
6872 std::map<double,double> esti_phierr;
6873 std::map<double,double> meas_zerr;
6874 std::map<double,double> esti_zerr;
6875 int ii=0;
6876 if(debug_==4){ cout << "wall size" << _BesKalmanFitWalls.size() << endl;}
6877 for(int iLayer=2; iLayer>=0; iLayer--)
6878 {
6879 posnew.clear();
6880 eanew.clear();
6881 anew.clear();
6882 esti1_r.clear();
6883 esti2_r.clear();
6884 esti1_phi.clear();
6885 esti2_phi.clear();
6886 esti1_z.clear();
6887 esti2_z.clear();
6888 diff1_phi.clear();
6889 diff1_z.clear();
6890 diff2_phi.clear();
6891 diff2_z.clear();
6892 meas_r.clear();
6893 meas_phi.clear();
6894 meas_z.clear();
6895 meas_phierr.clear();
6896 meas_zerr.clear();
6897 esti_phierr.clear();
6898 esti_zerr.clear();
6899 //cout<<"iLayer = "<<iLayer<<endl;
6900 int nHits=myGemHitCol[iLayer].size();
6901 //cout << "nhits" << nHits << "in layer" << iLayer << endl;
6902
6903 if (nHits <= 0) continue;
6904 //if(nHits!=1) continue;
6905
6906 vector<KalFitGemHit>::iterator iter;
6907 int ihit=0;
6908 // int ii=0;
6909 //cout <<"track before" << "pivot=" << track.pivot() << "a=" << track.a() << "ea=" <<track.Ea() << endl;
6910 innerwall(track,hypo,way,64+iLayer*(-32),88+iLayer*(-32));
6911 KalFitTrack track_start(track);
6912 //cout << "now position" << track_start.pivot().perp() << ","<< track_start.pivot().phi() << "," << track_start.pivot().z() <<endl;
6913 for(iter=myGemHitCol[iLayer].begin();iter!=myGemHitCol[iLayer].end();iter++ )
6914 {
6915 //cout <<"track" << "pivot=" << track.pivot() << "a=" << track.a() << "ea=" <<track.Ea() << endl;
6916 track.set(track_start.pivot(),track_start.a(),track_start.Ea());
6917 //cout << "track start" << "pivot=" << track_start.pivot() << "a=" << track_start.a() << "ea=" << track_start.Ea() << endl;
6918 double rGem=(*iter).getR();
6919 double phiGem=(*iter).getPhi();
6920 double zGem=(*iter).getZ();
6921 HepVector v_measu=(*iter).getVecPos();
6922 //cout << "hit" << ihit << "r=" << rGem << "phi=" << phiGem << "z=" << zGem << endl;
6923 // cout << "v_measu= " << v_measu << endl;
6924 /*
6925 double rGem=(myGemHitCol[iLayer].begin())->getR();
6926 double phiGem=(myGemHitCol[iLayer].begin())->getPhi();
6927 double zGem=(myGemHitCol[iLayer].begin())->getZ();
6928 HepVector v_measu=(myGemHitCol[iLayer].begin())->getVecPos();
6929 cout<<"v_measu = "<<v_measu<<endl;
6930 */
6931 double dPhiToGem = track.intersect_cylinder(rGem);
6932 //cout << "dPhiToGem=" << dPhiToGem << endl;
6933 HepPoint3D posEstiAtGem = track.x(dPhiToGem);
6934 double x0=posEstiAtGem.x();
6935 double y0=posEstiAtGem.y();
6936 double pathInGem;
6937 //cout << "before move" << "pivot" <<track.pivot() << "a" << track.a() << "ea" << track.Ea() << endl;
6938 track.pivot_numf(posEstiAtGem, pathInGem);
6939 //cout << "posEstiAtGem=" << posEstiAtGem << endl;
6940 //cout << "pathInGem=" << pathInGem << endl;
6941 if(pathInGem>0)
6942 {
6943 if(muls_) track.ms(pathInGem, _BesKalmanFitMaterials[26+32*iLayer], way);
6944 if(loss_) track.eloss(pathInGem, _BesKalmanFitMaterials[26+32*iLayer], way);
6945 }
6946 //cout << "after move" << "pivot" <<track.pivot() << "a" << track.a() << "ea" << track.Ea() << endl;
6947 double rGemEsti=posEstiAtGem.perp();
6948 double phiGemEsti=posEstiAtGem.phi();
6949 double zGemEsti=posEstiAtGem.z();
6950 HepVector v_estim(2,0);
6951 v_estim(1)=phiGemEsti;
6952 v_estim(2)=zGemEsti;
6953 //cout<<"GEM layer "<<iLayer+1<<" : MC r,phi,z="<<rGem<<", "<<phiGem<<", "<<zGem<<endl;
6954 //cout<<" esti r,phi,z="<<rGemEsti<<", "<<phiGemEsti<<", "<<zGemEsti<<endl;
6955 double dPhi=track.intersect_cylinder(rGem);
6956 //cout << "dPhi=" << dPhi << endl;
6957 HepPoint3D pos = track.x(dPhi);
6958 //cout<< "assumed esti phi,z" << pos.phi() << "," << pos.z() << endl;
6959 const HepSymMatrix& Ea = track.Ea();
6960 HepVector v_a = track.a();
6961 double drho=v_a(1);
6962 double phi0=v_a(2);
6963 double kappa=v_a(3);
6964 double tl=v_a(5);
6965 //cout<<"v_a = "<<v_a<<endl;
6966 //cout<<"phi0 = "<<phi0<<endl;
6967 // --- derivative matrix
6968 HepMatrix H(2, 5, 0);
6969 //H(1,2)=(x0*cos(phi0)-y0*sin(phi0))/(x0*x0+y0*y0);
6970 //H(2,4)=1.0;
6971 H(1,1)=-y0*cos(phi0)/(y0*y0+x0*x0)+x0*sin(phi0)/(x0*x0+y0*y0);
6972 //H(1,1)=(x0*cos(phi0)-y0*sin(phi0))/(x0*x0+y0*y0);
6973 //H(1,2)=-y0/(y0*y0+x0*x0)*sin(phi0+dPhi)-x0/(x0*x0+y0*y0)*cos(phi0+dPhi);
6974 H(1,2)=-y0/(y0*y0+x0*x0)*((-1)*drho*sin(phi0)+m_alpha/kappa*(sin(phi0+dPhi)-sin(phi0)))+x0/(x0*x0+y0*y0)*(drho*cos(phi0)+m_alpha/kappa*(cos(phi0)-cos(phi0+dPhi)));
6975 H(1,3)=-y0/(y0*y0+x0*x0)*(-1)*m_alpha/(kappa*kappa)*(cos(phi0)-cos(phi0+dPhi))+x0/(x0*x0+y0*y0)*(-1)*m_alpha/(kappa*kappa)*(sin(phi0)-sin(phi0+dPhi));
6976 H(2,3)=m_alpha/(kappa*kappa)*tl*dPhi;
6977 H(2,4)=1.0;
6978 H(2,5)=-1*(m_alpha/kappa)*dPhi;
6979 //cout<<"H="<<H<<endl;
6980 HepMatrix H_T=H.T();
6981 //cout<<"H_T="<<H_T<<endl;
6982 //cout << "H*v_a=" << H*v_a << endl;
6983 //cout << "H*v_a+estim=" <<H*v_a+v_estim << endl;
6984 // --- error matrix of Gem hit
6985 HepSymMatrix V=(*iter).getErrMat();
6986 //cout<<"V="<<V<<endl;
6987 HepMatrix HEa=H*Ea;
6988 HepMatrix HEaH_T=HEa*H_T;
6989 int ierr=-1;
6990 HepMatrix Vinv=(V+HEaH_T).inverse(ierr);
6991 if(ierr!=0) cout<<"error in HEaH_T.inverse()!"<<endl;
6992 // --- gain matrix
6993 HepMatrix K=Ea*H_T*Vinv;
6994 // --- new error matrix
6995 HepSymMatrix EaNew(5,0);
6996 EaNew.assign(Ea-K*H*Ea);
6997 // --- diff
6998 HepVector v_diff=v_measu-v_estim;
6999 //cout << "v_diff before= " << v_diff << endl;
7000 double delPhi=v_diff(1);
7001 if(fabs(v_diff(1))>6.28) v_measu(1)=-1*v_measu(1);
7002 while(delPhi> M_PI) delPhi-=M_PI;
7003 while(delPhi<-M_PI) delPhi+=M_PI;
7004 v_diff(1)=delPhi;
7005 //v_diff=v_measu-(H*v_a+v_estim);
7006 //cout<<"v_diff = "<<v_diff<<endl;
7007 // --- new parameters
7008 HepVector aNew=v_a+K*v_diff;
7009 //cout << "matrix K=" << K << endl;
7010 //cout << "aNew=" << aNew << endl;
7011 // --- new v_estim
7012 KalFitTrack track_test(posEstiAtGem,aNew,EaNew,hypo,0.0,track.nchits());
7013 double dPhiToGem_New = track_test.intersect_cylinder(rGem);
7014 HepPoint3D posEstiAtGem_new = track_test.x(dPhiToGem_New);
7015 double phiGemEsti_new=posEstiAtGem_new.phi();
7016 double zGemEsti_new=posEstiAtGem_new.z();
7017 double x0_new = posEstiAtGem_new.x();
7018 double y0_new = posEstiAtGem_new.y();
7019 HepVector v_estim_new(2,0);
7020 v_estim_new(1)=phiGemEsti_new;
7021 v_estim_new(2)=zGemEsti_new;
7022 //cout<<"v_estim_new = "<<v_estim_new<<endl;
7023 //cout << "assumed v_estim_new =" << H*aNew+v_estim << endl;
7024 // --- diff between measurement and updated estimation
7025 v_diff=v_measu-v_estim_new;
7026 delPhi=v_diff(1);
7027 while(delPhi> M_PI) delPhi-=M_PI;
7028 while(delPhi<-M_PI) delPhi+=M_PI;
7029 //cout<<"v_diff_new = "<<v_diff<<endl;
7030 //cout << "H*aNew"<< H*aNew << endl;
7031 //cout << "test v_diff new" << v_measu-v_estim-H*aNew << endl;
7032 // --- new derivative matrix
7033 track_test.pivot_numf(posEstiAtGem_new, pathInGem);
7034 HepVector v_a_new = track_test.a();
7035 //cout << "v_a_new=" << v_a_new << endl;
7036 HepSymMatrix Ea_new = track_test.Ea();
7037 //cout << "Ea_new =" << Ea_new << endl;
7038 double phi0_new = v_a_new(2);
7039 double kappa_new=v_a_new(3);
7040 HepMatrix H_new(2, 5, 0);
7041 //H_new(1,1)=-y0_new/(x0_new*x0_new+y0_new*y0_new)*cos(phi0_new)+x0_new/(x0_new*x0_new+y0_new*y0_new)*sin(phi0_new);
7042 //H_new(2,4)=1.0;
7043 //H_new(1,1)=(x0_new*cos(phi0_new)-y0_new*sin(phi0_new))/(x0_new*x0_new+y0_new*y0_new);
7044
7045 /* H_new(1,1)=-y0_new/(1+x0_new*x0_new)*cos(phi0_new)+x0_new/(x0_new*x0_new+y0_new*y0_new)*sin(phi0_new);
7046 H_new(1,2)=-y0_new/(1+x0_new*x0_new)*sin(phi0_new+dPhiToGem_New)-x0_new/(x0_new*x0_new+y0_new*y0_new)*cos(phi0_new+dPhiToGem_New);
7047 H_new(2,4)=1.0;
7048 H_new(2,5)=-(-333.564095)/kappa_new*dPhiToGem_New;*/
7049 HepMatrix H_new_T=H_new.T();
7050 // --- R mactrix
7051 //cout<<"H_new*Ea_new*H_new_T = "<<H_new*Ea_new*H_new_T<<endl;
7052 //cout << "H*Ea_new*H_T=" << H*Ea_new*H_T << endl;
7053 //cout << "H*EaNew*H_T=" << H*EaNew*H_T<< endl;
7054 //cout << "H_new*Eanew*H_new_T = "<< H_new*EaNew*H_new_T << endl;
7055 //cout << "assumed R=" <<V-H*Ea_new*H_T << endl;
7056 HepSymMatrix R(2,0);
7057 //R.assign(V-H_new*Ea_new*H_new_T);
7058 R.assign(V-H*EaNew*H_T);
7059
7060 //cout << "test track" << "pivot" << track.pivot() << "a" << track.a() << "ea" << track.Ea() << endl;
7061 // --- Chi^2 added
7062 //cout << "v_diff_T=" << v_diff.T() <<endl;
7063 //cout << "v_diff=" << v_diff <<endl;
7064 //cout << "R="<<R << endl;
7065 //cout << "R inverse=" << R.inverse(ierr)<< endl;
7066 HepVector v_dChi2=v_diff.T()*R.inverse(ierr)*v_diff;
7067 if(ierr!=0) cout<<"error in R.inverse()!"<<endl;
7068 //cout<<"v_dChi2 = "<<v_dChi2<<endl;
7069 //cout<< "test dchi2=" << (H*v_a).T()*R.inverse(ierr)*(H*v_a) << endl;
7070 double dChi2=v_dChi2(1);
7071
7072 // --- comparison
7073 if(debug_==4){
7074 cout<<"pivot: "<<posEstiAtGem<<endl;
7075 cout<<"new pivot: "<<posEstiAtGem<<endl;
7076 cout<<"a: "<<v_a<<endl;
7077 cout<<"new a: "<<aNew<<endl;
7078 cout<<"Ea: "<<Ea<<endl;
7079 cout<<"new Ea: "<<EaNew<<endl;
7080 cout<<"dchi2= "<<dChi2<<endl;
7081 }
7082 /* if(ntuple_&1){
7083 m_diff[ii]=delPhi;
7084 cout << v_diff(2) << endl;
7085 m_diffz[ii]=v_diff(2);
7086 m_phi[ii]=phiGem;
7087 m_z[ii]=zGem;
7088 m_Gemdchi2[ii]=dChi2;
7089 m_Glayer[ii]=iLayer;
7090 m_hypo[ii]=hypo;
7091 m_meas_r[ii]=rGem;
7092 m_meas_phi[ii]=phiGem;
7093 m_meas_z[ii]=zGem;
7094 m_esti1_r[ii]=rGemEsti;
7095 m_esti1_phi[ii]=phiGemEsti;
7096 m_esti1_z[ii]=zGemEsti;
7097 m_esti2_r[ii]=rGem;
7098 m_esti2_phi[ii]=phiGemEsti_new;
7099 m_esti2_z[ii]=zGemEsti_new;
7100 m_diff1_phi[ii]=phiGem-phiGemEsti;
7101 m_diff1_z[ii]=zGem-zGemEsti;
7102 m_diff2_phi[ii]=phiGem-phiGemEsti_new;
7103 m_diff2_z[ii]=zGem-zGemEsti_new;
7104 m_Gchi2[ii]=dChi2;
7105 m_GemLayer[ii]=iLayer;
7106 m_mass[ii]=hypo;
7107 } */
7108 // --- update KalFitTrack
7109 //track.set(posEstiAtGem_new,v_a_new,Ea_new);
7110 //dchi2_all.push_back(dChi2);
7111 //posnew.push_back(posEstiAtGem_new);
7112 //anew.push_back(v_a_new);
7113 //eanew.push_back(Ea_new);
7114 //dchi2[ii]=dChi2;
7115 esti1_r[dChi2]=rGemEsti;
7116 esti1_phi[dChi2]=phiGemEsti;
7117 esti1_z[dChi2]=zGemEsti;
7118 esti2_r[dChi2]=rGem;
7119 esti2_phi[dChi2]=phiGemEsti_new;
7120 esti2_z[dChi2]=zGemEsti_new;
7121 diff1_phi[dChi2]=phiGem-phiGemEsti;
7122 diff1_z[dChi2]=zGem-zGemEsti;
7123 diff2_phi[dChi2]=phiGem-phiGemEsti_new;
7124 diff2_z[dChi2]=zGem-zGemEsti_new;
7125 posnew[dChi2]=posEstiAtGem;
7126 anew[dChi2]=aNew;
7127 eanew[dChi2]=EaNew;
7128 meas_r[dChi2]=rGem;
7129 meas_phi[dChi2]=phiGem;
7130 //cout << "meas_phi[dChi2]" << phiGem << endl;
7131 meas_z[dChi2]=zGem;
7132 meas_phierr[dChi2]=sqrt(V[0][0]);
7133 //cout << "meas_phierr[dChi2]" << meas_phierr[dChi2] << endl;
7134 meas_zerr[dChi2]=sqrt(V[1][1]);
7135 //cout << "meas_zerr[dChi2]" << meas_zerr[dChi2] << endl;
7136 esti_phierr[dChi2]=sqrt((H*(track_start.Ea())*H_T)[0][0]);
7137 //cout << "esti_phierr[dChi2]" << esti_phierr[dChi2] << endl;
7138 esti_zerr[dChi2]=sqrt((H*(track_start.Ea())*H_T)[1][1]);
7139 //cout << "esti_zerr[dChi2]" << esti_zerr[dChi2] << endl;
7140
7141 ihit++;
7142 // ii++;
7143 }
7144
7145 //m_Gemhits=ii;
7146 //m_nt7->write();
7147 track.set((posnew.begin())->second,(anew.begin())->second,(eanew.begin()->second));
7148
7149 CgemGeoLayer* CgemLayer = m_CgemGeomSvc_->getCgemLayer(iLayer);
7150 double new_dPhiToGem = track.intersect_cylinder((CgemLayer->getInnerROfGapD())/10);
7151 HepPoint3D new_posEstiAtGem = track.x(new_dPhiToGem);
7152 double new_pathInGem;
7153 //cout << "new_dPhiToGem" << new_dPhiToGem << endl;
7154 //cout << "before move2" << "pivot" <<track.pivot().perp() << "," << track.pivot().phi() << "," << track.pivot().z()<< "a" << track.a() << "ea" << track.Ea() << endl;
7155 track.pivot_numf(new_posEstiAtGem, new_pathInGem);
7156 //cout << "posEstiAtGem2=" << new_posEstiAtGem << endl;
7157 //cout << "pathInGem2=" << new_pathInGem << endl;
7158 if(new_pathInGem>0)
7159 {
7160 if(muls_) track.ms(new_pathInGem, _BesKalmanFitMaterials[26+32*iLayer], way);
7161 if(loss_) track.eloss(new_pathInGem, _BesKalmanFitMaterials[26+32*iLayer], way);
7162 }
7163 //cout << "after move2: " << "pivot" <<track.pivot().perp() << "," << track.pivot().phi() << "," << track.pivot().z() << "a" << track.a() << "ea" << track.Ea() << endl;
7164 if(iLayer>=1){
7165 innerwall(track,hypo,way,90+(-32)*iLayer,95+(-32)*iLayer);}
7166 else{
7167 innerwall(track,hypo,way,90+(-32)*iLayer,94+(-32)*iLayer);}
7168 //cout <<"!!!!ntuple" << ntuple_ << endl;
7169 //cout << "!!!(esti1_phi.begin())->second" << (esti1_phi.begin())->second << endl;
7170 //cout<<" Finish innerwall"<<endl;
7171 if(ntuple_&1)
7172 {
7173 //cout << "good!" << endl;
7174 //cout << "m_esti1_r[ii]0" << m_esti1_r[ii] << endl;
7175 m_esti1_r[ii]=(esti1_r.begin())->second;
7176 //cout << "m_esti1_r[ii]1" << m_esti1_r[ii] << endl;
7177 m_esti1_phi[ii]=(esti1_phi.begin())->second;
7178 m_esti1_z[ii]=(esti1_z.begin())->second;
7179 m_esti2_r[ii]=(esti2_r.begin())->second;
7180 m_esti2_phi[ii]=(esti2_phi.begin())->second;
7181 m_esti2_z[ii]=(esti2_z.begin())->second;
7182 m_diff1_phi[ii]=(diff1_phi.begin())->second;
7183 m_diff1_z[ii]=(diff1_z.begin())->second;
7184 m_diff2_phi[ii]=(diff2_phi.begin())->second;
7185 m_diff2_z[ii]=(diff2_z.begin())->second;
7186 m_Gchi2[ii]=(esti1_r.begin())->first;
7187 m_meas_r[ii]=(meas_r.begin())->second;
7188 m_meas_phi[ii]=(meas_phi.begin())->second;
7189 //cout << "m_meas_phi[ii]" << m_meas_phi[ii] << endl;
7190 m_meas_z[ii]=(meas_z.begin())->second;
7191 m_meas_phierr[ii]=(meas_phierr.begin())->second;
7192 m_meas_zerr[ii]=(meas_zerr.begin())->second;
7193 m_esti_phierr[ii]=(esti_phierr.begin())->second;
7194 m_esti_zerr[ii]=(esti_zerr.begin())->second;
7195 m_GemLayer[ii]=iLayer;
7196 m_mass[ii]=hypo;
7197 }
7198 //cout<<" end of ntuple_"<<endl;
7199 ii++;
7200 }// loop layers
7201 //cout<<"finish layer loop"<<endl;
7202
7203 //SmartDataPtr<Event::EventHeader> evtHeader(eventSvc(),"/Event/EventHeader");
7204 //m_evt3 = evtHeader->eventNumber();
7205 if(ifProdNt10) {
7206 //cout << "m_meas_phi[ii]" << m_meas_phi[0] << endl;
7207 if(m_meas_phi[0]>0 && m_meas_phi[0]<1.5707963) m_qua=0;
7208 if(m_meas_phi[0]>1.5707963 && m_meas_phi[0]<3.1415926) m_qua=1;
7209 if(m_meas_phi[0]>-3.1415926&& m_meas_phi[0]<-1.5707963) m_qua=2;
7210 if(m_meas_phi[0]>-1.5707963&& m_meas_phi[0]<0) m_qua=3;
7211 //cout << "m_qua=" << m_qua << endl;
7212 m_nGemHits=ii;
7213 }
7214 //m_Gemhits=ii;
7215 // m_nt7->write();
7216 // m_nt10->write();
7217 posnew.clear();
7218 eanew.clear();
7219 anew.clear();
7220 esti1_r.clear();
7221 esti2_r.clear();
7222 esti1_phi.clear();
7223 esti2_phi.clear();
7224 esti1_z.clear();
7225 esti2_z.clear();
7226 diff1_phi.clear();
7227 diff1_z.clear();
7228 diff2_phi.clear();
7229 diff2_z.clear();
7230 meas_r.clear();
7231 meas_phi.clear();
7232 meas_z.clear();
7233 meas_phierr.clear();
7234 meas_zerr.clear();
7235 esti_phierr.clear();
7236 esti_zerr.clear();
7237
7238 }// end of GEM Kalman fit
7239 //cout << "end of GEM Kalman fit" << endl;
7240 if(ifProdNt10) {
7241 SmartDataPtr<Event::EventHeader> evtHeader(eventSvc(),"/Event/EventHeader");
7242 //cout << "evtHeader" << m_evt3 << endl;
7243 m_evt3 = evtHeader->eventNumber();
7244 m_nt10->write();
7245 }
7246
7247}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
void ms(double path, const KalFitMaterial &m, int index)
void set(const HepPoint3D &pivot, const HepVector &a, const HepSymMatrix &Ea)
sets helix pivot position, parameters, and error matrix.
IMPLICIT REAL *A H
Definition: myXsection.h:1
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)
Definition: TUtil.h:27

◆ fitGemHits() [2/2]

void KalFitAlg::fitGemHits ( KalFitTrack track,
int  hypo,
int  way 
)

◆ fromFHitToInnerWall() [1/2]

void KalFitAlg::fromFHitToInnerWall ( KalFitTrack track,
int  way 
)

Definition at line 6356 of file KalFitAlg.cxx.

6357{
6358 double rMaxInnerWall=6.42005+0.00495;
6359 if(useNCGem_>1) { // GEM mode
6360 //rMaxInnerWall=m_CGEM.end()->radius();
6361 //rMaxInnerWall=16.7;
6362 rMaxInnerWall=m_innerWall[0].radius();
6363 }
6364 else { // MDC mode
6365 rMaxInnerWall=_BesKalmanFitWalls[0].radius();
6366 }
6367 double dPhiToInnerWall = track.intersect_cylinder(rMaxInnerWall);
6368 HepPoint3D posAtInnerWall = track.x(dPhiToInnerWall);
6369 double pathToInnerWall;
6370 track.pivot_numf(posAtInnerWall, pathToInnerWall);
6371 //cout<<"__FUNCTION__: rMaxInnerWall = "<<rMaxInnerWall<<endl;
6372 //cout<<"posAtInnerWall, pathToInnerWall = "<<posAtInnerWall<<", "<<pathToInnerWall<<endl;
6373 if(pathToInnerWall>0)
6374 {
6375 if(muls_) track.ms(pathToInnerWall, _BesKalmanFitMaterials[0], way);
6376 if(loss_) track.eloss(pathToInnerWall, _BesKalmanFitMaterials[0], way);
6377 }
6378 if(useNCGem_>0) m_innerWall[0].updateTrack(track, way);
6379
6380}

◆ fromFHitToInnerWall() [2/2]

void KalFitAlg::fromFHitToInnerWall ( KalFitTrack track,
int  way 
)

◆ getEventStarTime() [1/2]

void KalFitAlg::getEventStarTime ( void  )

◆ getEventStarTime() [2/2]

void KalFitAlg::getEventStarTime ( void  )

◆ getWallMdcNumber() [1/2]

int KalFitAlg::getWallMdcNumber ( const HepPoint3D point)

◆ getWallMdcNumber() [2/2]

int KalFitAlg::getWallMdcNumber ( const HepPoint3D point)

◆ hist_def() [1/2]

void KalFitAlg::hist_def ( void  )

hist definition

Definition at line 369 of file KalFitAlg.cxx.

370{
371 if(ntuple_&1) {
372 NTuplePtr nt1(ntupleSvc(),"FILE104/n101");
373 StatusCode status;
374 if ( nt1 ) m_nt1 = nt1;
375 else {
376 m_nt1= ntupleSvc()->book("FILE104/n101",CLID_ColumnWiseTuple,"KalFit");
377 if ( m_nt1 ) {
378
379 status = m_nt1->addItem("trackid",m_trackid);
380 status = m_nt1->addItem("stat",5,2,m_stat);
381 status = m_nt1->addItem("ndf",5,2,m_ndf);
382 status = m_nt1->addItem("chisq",5,2,m_chisq);
383 status = m_nt1->addItem("length",5,m_length);
384 status = m_nt1->addItem("tof",5,m_tof);
385 status = m_nt1->addItem("nhits",5,m_nhits);
386 status = m_nt1->addItem("zhelix",5,m_zhelix);
387 status = m_nt1->addItem("zhelixe",5,m_zhelixe);
388 status = m_nt1->addItem("zhelixmu",5,m_zhelixmu);
389 status = m_nt1->addItem("zhelixk",5,m_zhelixk);
390 status = m_nt1->addItem("zhelixp",5,m_zhelixp);
391 status = m_nt1->addItem("zptot",m_zptot);
392 status = m_nt1->addItem("zptote",m_zptote);
393 status = m_nt1->addItem("zptotmu",m_zptotmu);
394 status = m_nt1->addItem("zptotk",m_zptotk);
395 status = m_nt1->addItem("zptotp",m_zptotp);
396
397 status = m_nt1->addItem("zpt",m_zpt);
398 status = m_nt1->addItem("zpte",m_zpte);
399 status = m_nt1->addItem("zptmu",m_zptmu);
400 status = m_nt1->addItem("zptk",m_zptk);
401 status = m_nt1->addItem("zptp",m_zptp);
402
403 status = m_nt1->addItem("fptot",m_fptot);
404 status = m_nt1->addItem("fptote",m_fptote);
405 status = m_nt1->addItem("fptotmu",m_fptotmu);
406 status = m_nt1->addItem("fptotk",m_fptotk);
407 status = m_nt1->addItem("fptotp",m_fptotp);
408 status = m_nt1->addItem("fpt",m_fpt);
409 status = m_nt1->addItem("fpte",m_fpte);
410 status = m_nt1->addItem("fptmu",m_fptmu);
411 status = m_nt1->addItem("fptk",m_fptk);
412 status = m_nt1->addItem("fptp",m_fptp);
413
414 status = m_nt1->addItem("lptot",m_lptot);
415 status = m_nt1->addItem("lptote",m_lptote);
416 status = m_nt1->addItem("lptotmu",m_lptotmu);
417 status = m_nt1->addItem("lptotk",m_lptotk);
418 status = m_nt1->addItem("lptotp",m_lptotp);
419 status = m_nt1->addItem("lpt",m_lpt);
420 status = m_nt1->addItem("lpte",m_lpte);
421 status = m_nt1->addItem("lptmu",m_lptmu);
422 status = m_nt1->addItem("lptk",m_lptk);
423 status = m_nt1->addItem("lptp",m_lptp);
424
425 status = m_nt1->addItem("zsigp",m_zsigp);
426 status = m_nt1->addItem("zsigpe",m_zsigpe);
427 status = m_nt1->addItem("zsigpmu",m_zsigpmu);
428 status = m_nt1->addItem("zsigpk",m_zsigpk);
429 status = m_nt1->addItem("zsigpp",m_zsigpp);
430 status = m_nt1->addItem("fhelix",5,m_fhelix);
431 status = m_nt1->addItem("fhelixe",5,m_fhelixe);
432 status = m_nt1->addItem("fhelixmu",5,m_fhelixmu);
433 status = m_nt1->addItem("fhelixk",5,m_fhelixk);
434 status = m_nt1->addItem("fhelixp",5,m_fhelixp);
435 status = m_nt1->addItem("lhelix",5,m_lhelix);
436 status = m_nt1->addItem("lhelixe",5,m_lhelixe);
437 status = m_nt1->addItem("lhelixmu",5,m_lhelixmu);
438 status = m_nt1->addItem("lhelixk",5,m_lhelixk);
439 status = m_nt1->addItem("lhelixp",5,m_lhelixp);
440 status = m_nt1->addItem("rGem",4,m_rGem);
441 status = m_nt1->addItem("chi2Gem",4,m_chi2Gem);
442 status = m_nt1->addItem("phiGemExp",4,m_phiGemExp);
443 status = m_nt1->addItem("phiGemHit",4,m_phiGemHit);
444 status = m_nt1->addItem("zGemExp",4,m_zGemExp);
445 status = m_nt1->addItem("zGemHit",4,m_zGemHit);
446 if(ntuple_&32) {
447 status = m_nt1->addItem("zerror",15,m_zerror);
448 status = m_nt1->addItem("zerrore",15,m_zerrore);
449 status = m_nt1->addItem("zerrormu",15,m_zerrormu);
450 status = m_nt1->addItem("zerrork",15,m_zerrork);
451 status = m_nt1->addItem("zerrorp",15,m_zerrorp);
452 status = m_nt1->addItem("ferror",15,m_ferror);
453 status = m_nt1->addItem("ferrore",15,m_ferrore);
454 status = m_nt1->addItem("ferrormu",15,m_ferrormu);
455 status = m_nt1->addItem("ferrork",15,m_ferrork);
456 status = m_nt1->addItem("ferrorp",15,m_ferrorp);
457 status = m_nt1->addItem("lerror",15,m_lerror);
458 status = m_nt1->addItem("lerrore",15,m_lerrore);
459 status = m_nt1->addItem("lerrormu",15,m_lerrormu);
460 status = m_nt1->addItem("lerrork",15,m_lerrork);
461 status = m_nt1->addItem("lerrorp",15,m_lerrorp);
462 }
463 if((ntuple_&16)&&(ntuple_&1)) {
464 status = m_nt1->addItem("evtid",m_evtid);
465 status = m_nt1->addItem("mchelix",5,m_mchelix);
466 status = m_nt1->addItem("mcptot",m_mcptot);
467 status = m_nt1->addItem("mcpid",m_mcpid);
468 }
469 if( status.isFailure() ) cout<<"Ntuple1 add item failed!"<<endl;
470 }
471 }
472 }
473
474 if(ntuple_&4) {
475 NTuplePtr nt2(ntupleSvc(),"FILE104/n102");
476 StatusCode status2;
477 if ( nt2 ) m_nt2 = nt2;
478 else {
479 m_nt2= ntupleSvc()->book("FILE104/n102",CLID_ColumnWiseTuple,"KalFitComp");
480 if ( m_nt2 ) {
481 status2 = m_nt2->addItem("delx",m_delx);
482 status2 = m_nt2->addItem("dely",m_dely);
483 status2 = m_nt2->addItem("delz",m_delz);
484 status2 = m_nt2->addItem("delthe",m_delthe);
485 status2 = m_nt2->addItem("delphi",m_delphi);
486 status2 = m_nt2->addItem("delp",m_delp);
487 status2 = m_nt2->addItem("delpx",m_delpx);
488 status2 = m_nt2->addItem("delpy",m_delpy);
489 status2 = m_nt2->addItem("delpz",m_delpz);
490
491 if( status2.isFailure() ) cout<<"Ntuple2 add item failed!"<<endl;
492 }
493 }
494 }
495
496 if(ntuple_&2) {
497 NTuplePtr nt3(ntupleSvc(),"FILE104/n103");
498 StatusCode status3;
499 if ( nt3 ) m_nt3 = nt3;
500 else {
501 m_nt3= ntupleSvc()->book("FILE104/n103",CLID_ColumnWiseTuple,"PatRec");
502 if ( m_nt3 ) {
503 status3 = m_nt3->addItem("trkhelix",5,m_trkhelix);
504 status3 = m_nt3->addItem("trkptot",m_trkptot);
505 if(ntuple_&32) {
506 status3 = m_nt3->addItem("trkerror",15,m_trkerror);
507 status3 = m_nt3->addItem("trksigp",m_trksigp);
508 }
509 status3 = m_nt3->addItem("trkndf",m_trkndf);
510 status3 = m_nt3->addItem("trkchisq",m_trkchisq);
511 if( status3.isFailure() ) cout<<"Ntuple3 add item failed!"<<endl;
512 }
513 }
514 }
515
516 if(ntuple_&4) {
517 NTuplePtr nt4(ntupleSvc(),"FILE104/n104");
518 StatusCode status4;
519 if ( nt4 ) m_nt4 = nt4;
520 else {
521 m_nt4= ntupleSvc()->book("FILE104/n104",CLID_ColumnWiseTuple,"PatRecComp");
522 if ( m_nt4 ) {
523 status4 = m_nt4->addItem("trkdelx",m_trkdelx);
524 status4 = m_nt4->addItem("trkdely",m_trkdely);
525 status4 = m_nt4->addItem("trkdelz",m_trkdelz);
526 status4 = m_nt4->addItem("trkdelthe",m_trkdelthe);
527 status4 = m_nt4->addItem("trkdelphi",m_trkdelphi);
528 status4 = m_nt4->addItem("trkdelp",m_trkdelp);
529 if( status4.isFailure() ) cout<<"Ntuple4 add item failed!"<<endl;
530 }
531 }
532 }
533 if(ntuple_&8) {
534 NTuplePtr nt5(ntupleSvc(), "FILE104/n105");
535 StatusCode status5;
536 if ( nt5 ) m_nt5 = nt5;
537 else {
538 m_nt5= ntupleSvc()->book("FILE104/n105",CLID_ColumnWiseTuple,"KalFitdChisq");
539 if ( m_nt5 ) {
540 status5 = m_nt5->addItem("dchi2",m_dchi2);
541 status5 = m_nt5->addItem("masshyp",m_masshyp);
542 status5 = m_nt5->addItem("residual_estim",m_residest);
543 status5 = m_nt5->addItem("residual",m_residnew);
544 status5 = m_nt5->addItem("layer",m_layer);
545 status5 = m_nt5->addItem("kaldr",m_anal_dr);
546 status5 = m_nt5->addItem("kalphi0",m_anal_phi0);
547 status5 = m_nt5->addItem("kalkappa",m_anal_kappa);
548 status5 = m_nt5->addItem("kaldz",m_anal_dz);
549 status5 = m_nt5->addItem("kaltanl",m_anal_tanl);
550 status5 = m_nt5->addItem("dr_ea",m_anal_ea_dr);
551 status5 = m_nt5->addItem("phi0_ea",m_anal_ea_phi0);
552 status5 = m_nt5->addItem("kappa_ea",m_anal_ea_kappa);
553 status5 = m_nt5->addItem("dz_ea",m_anal_ea_dz);
554 status5 = m_nt5->addItem("tanl_ea",m_anal_ea_tanl);
555 if( status5.isFailure() ) cout<<"Ntuple5 add item failed!"<<endl;
556 }
557 }
558 }
559
560 NTuplePtr nt6(ntupleSvc(),"FILE104/n106");
561 StatusCode status6;
562 if ( nt6 ) m_nt6 = nt6;
563 else {
564 m_nt6= ntupleSvc()->book("FILE104/n106",CLID_ColumnWiseTuple,"kal seg");
565 if ( m_nt6 ) {
566 status6 = m_nt6->addItem("docaInc",m_docaInc);
567 status6 = m_nt6->addItem("docaExc",m_docaExc);
568 status6 = m_nt6->addItem("tdr",m_tdrift);
569 status6 = m_nt6->addItem("layerid", m_layerid);
570 status6 = m_nt6->addItem("event", m_eventNo);
571 status6 = m_nt6->addItem("residualInc",m_residualInc);
572 status6 = m_nt6->addItem("residualExc",m_residualExc);
573 status6 = m_nt6->addItem("lr",m_lr);
574 status6 = m_nt6->addItem("dd",m_dd);
575 status6 = m_nt6->addItem("y",m_yposition);
576
577 if( status6.isFailure() ) cout<<"Ntuple6 add item failed!"<<endl;
578 }
579 }
580
581 if(ifProdNt10) {
582 NTuplePtr nt10(ntupleSvc(),"FILE104/n110");
583 StatusCode status10;
584 if ( nt10 ) m_nt10 = nt10;
585 else {
586 m_nt10= ntupleSvc()->book("FILE104/n110",CLID_ColumnWiseTuple,"test");
587 if ( m_nt10 ) {
588 status10 = m_nt10->addItem("evt",m_evt3);
589 status10 = m_nt10->addItem("qua",m_qua);
590 status10 = m_nt10->addItem("nhit",m_nGemHits,0,4000000);
591 status10 = m_nt10->addIndexedItem("meas_r",m_nGemHits,m_meas_r);
592 status10 = m_nt10->addIndexedItem("meas_phi",m_nGemHits,m_meas_phi);
593 status10 = m_nt10->addIndexedItem("meas_z",m_nGemHits,m_meas_z);
594 status10 = m_nt10->addIndexedItem("esti1_r",m_nGemHits,m_esti1_r);
595 status10 = m_nt10->addIndexedItem("esti1_phi",m_nGemHits,m_esti1_phi);
596 status10 = m_nt10->addIndexedItem("esti1_z",m_nGemHits,m_esti1_z);
597 status10 = m_nt10->addIndexedItem("esti2_r",m_nGemHits,m_esti2_r);
598 status10 = m_nt10->addIndexedItem("esti2_phi",m_nGemHits,m_esti2_phi);
599 status10 = m_nt10->addIndexedItem("esti2_z",m_nGemHits,m_esti2_z);
600 status10 = m_nt10->addIndexedItem("diff1_phi",m_nGemHits,m_diff1_phi);
601 status10 = m_nt10->addIndexedItem("diff1_z",m_nGemHits,m_diff1_z);
602 status10 = m_nt10->addIndexedItem("diff2_phi",m_nGemHits,m_diff2_phi);
603 status10 = m_nt10->addIndexedItem("diff2_z",m_nGemHits,m_diff2_z);
604 status10 = m_nt10->addIndexedItem("layer",m_nGemHits,m_GemLayer);
605 status10 = m_nt10->addIndexedItem("mass",m_nGemHits,m_mass);
606 status10 = m_nt10->addIndexedItem("dchi2",m_nGemHits,m_Gchi2);
607 status10 = m_nt10->addIndexedItem("meas_phierr",m_nGemHits,m_meas_phierr);
608 status10 = m_nt10->addIndexedItem("meas_zerr",m_nGemHits,m_meas_zerr);
609 status10 = m_nt10->addIndexedItem("esti_phierr",m_nGemHits,m_esti_phierr);
610 status10 = m_nt10->addIndexedItem("esti_zerr",m_nGemHits,m_esti_zerr);
611 if( status10.isFailure() ) cout<<"Ntuple10 add item failed!"<<endl;
612 }
613 }
614 }
615
616 if(ifProdNt11) {
617 NTuplePtr nt11(ntupleSvc(),"FILE104/n111");
618 StatusCode status11;
619 if ( nt11 ) m_nt11 = nt11;
620 else {
621 m_nt11= ntupleSvc()->book("FILE104/n111",CLID_ColumnWiseTuple,"truth");
622 if ( m_nt11 ) {
623 status11 = m_nt11->addItem("evt",m_evt4);
624 status11 = m_nt11->addItem("ntruth",m_ntruth,0,400000);
625 status11 = m_nt11->addIndexedItem("phi",m_ntruth,m_dtphi);
626 status11 = m_nt11->addIndexedItem("z",m_ntruth,m_dtv);
627 status11 = m_nt11->addIndexedItem("postphi",m_ntruth,m_dtpostphi);
628 status11 = m_nt11->addIndexedItem("postz",m_ntruth,m_dtpostz);
629 status11 = m_nt11->addIndexedItem("layer",m_ntruth,m_tlayer);
630 if( status11.isFailure() ) cout<<"Ntuple11 add item failed!"<<endl;
631 }
632 }
633 }
634
635 if(ifProdNt12) {
636 NTuplePtr nt12(ntupleSvc(),"FILE104/n112");
637 StatusCode status12;
638 if ( nt12 ) m_nt12 = nt12;
639 else {
640 m_nt12= ntupleSvc()->book("FILE104/n112",CLID_ColumnWiseTuple,"PatRecComp");
641 if ( m_nt12 ) {
642 status12 = m_nt12->addItem("evt",m_evt);
643 status12 = m_nt12->addItem("track",m_track);
644 status12 = m_nt12->addItem("diff_dr",m_diff_dr);
645 status12 = m_nt12->addItem("diff_phi0",m_diff_phi0);
646 status12 = m_nt12->addItem("diff_kappa",m_diff_kappa);
647 status12 = m_nt12->addItem("diff_dz",m_diff_dz);
648 status12 = m_nt12->addItem("diff_tanl",m_diff_tanl);
649 status12 = m_nt12->addItem("diff_p",m_diff_p);
650 if( status12.isFailure() ) cout<<"Ntuple12 add item failed!"<<endl;
651 }
652 }
653 }
654}

Referenced by initialize().

◆ hist_def() [2/2]

void KalFitAlg::hist_def ( void  )

hist definition

◆ init_matrix() [1/4]

void KalFitAlg::init_matrix ( int  k,
MdcRec_trk trk,
HepSymMatrix &  Ea 
)

Definition at line 6036 of file KalFitAlg.cxx.

6037{
6038 if(0==k){
6039 for ( int i=0; i<5; i++) {
6040 for( int j = 1; j<i+2;j++) {
6041 Eakal(i+1,j) = matrixg_*(trk.error[i*(i+1)/2+j-1]);
6042 Eakal(j,i+1) = Eakal(i+1,j);
6043 }
6044 Eakal(1,1) = Eakal(1,1)* gain1_;
6045 Eakal(2,2) = Eakal(2,2)* gain2_;
6046 Eakal(3,3) = Eakal(3,3)* gain3_;
6047 Eakal(4,4) = Eakal(4,4)* gain4_;
6048 Eakal(5,5) = Eakal(5,5)* gain5_;
6049 }
6050 }
6051 // HepSymMatrix ea_temp(5);
6052 // for(int i = 0, k = 0; i < 5; i++) {
6053 // for(int j = 0; j <= i; j++) {
6054 // ea_temp[i][j] = matrixg_*trk.error[k++];
6055 // ea_temp[j][i] = ea_temp[i][j];
6056 // }
6057 // }
6058
6059 if(1==k){
6060 Eakal(1,1) = .2;
6061 Eakal(2,2) = .001;
6062 Eakal(3,3) = 1.0;
6063 Eakal(4,4) = 10.0;
6064 Eakal(5,5) = 0.002;
6065 }
6066
6067 if(2==k){
6068 Eakal(1,1) = .2;
6069 Eakal(2,2) = 0.1;
6070 Eakal(3,3) = 1.0;
6071 Eakal(4,4) = 25.0;
6072 Eakal(5,5) = 0.10;
6073 }
6074
6075
6076 if(3==k){
6077 Eakal(1,1) = .2;
6078 Eakal(2,2) = .001;
6079 Eakal(3,3) = 1.0;
6080 Eakal(4,4) = 25.0;
6081 Eakal(5,5) = 0.10;
6082 }
6083
6084 if(4==k){
6085 Eakal(1,1) = .2;
6086 Eakal(2,2) = .01;
6087 Eakal(3,3) = 0.01;
6088 Eakal(4,4) = 1.;
6089 Eakal(5,5) = .01;
6090 }
6091
6092 if(5==k) {
6093 Eakal(1,1) = 2.;
6094 Eakal(2,2) = 0.1;
6095 Eakal(3,3) = 1.;
6096 Eakal(4,4) = 20.;
6097 Eakal(5,5) = 0.1;
6098 }
6099
6100 if(6==k) {
6101 Eakal(1,1) = 0.01;
6102 Eakal(2,2) = 0.01;
6103 Eakal(3,3) = 0.01;
6104 Eakal(4,4) = 100.;
6105 Eakal(5,5) = 0.5;
6106 }
6107
6108 if(k!=0){
6109 Eakal(3,3) = 0.2;
6110 Eakal(1,1) = 1;
6111 Eakal(4,4) = 1;
6112 }
6113
6114 if (debug_ == 4) cout<<"initialised Eakal.. "<<Eakal<<endl;
6115}

◆ init_matrix() [2/4]

void KalFitAlg::init_matrix ( int  k,
MdcRec_trk trk,
HepSymMatrix &  Ea 
)

◆ init_matrix() [3/4]

void KalFitAlg::init_matrix ( MdcRec_trk trk,
HepSymMatrix &  Ea 
)

Definition at line 6022 of file KalFitAlg.cxx.

6023{
6024 for ( int i=0; i<5; i++) {
6025 for( int j = 1; j<i+2;j++) {
6026 Eakal(i+1,j) = matrixg_*(trk.error[i*(i+1)/2+j-1]);
6027 Eakal(j,i+1) = Eakal(i+1,j);
6028 }
6029 }
6030
6031 if (debug_ == 4) cout<<"initialised Ea.. "<<Eakal<<endl;
6032}

Referenced by complete_track(), kalman_fitting_anal(), kalman_fitting_calib(), kalman_fitting_csmalign(), kalman_fitting_MdcxReco_Csmc_Sew(), and start_seed().

◆ init_matrix() [4/4]

void KalFitAlg::init_matrix ( MdcRec_trk trk,
HepSymMatrix &  Ea 
)

◆ initialize() [1/2]

StatusCode KalFitAlg::initialize ( )

initialize

Definition at line 204 of file KalFitAlg.cxx.

205{
206 MsgStream log(msgSvc(), name());
207 log << MSG::INFO << "in initize()"
208 << "KalFit> Initialization for current run " << endreq;
209 log << MSG::INFO << "Present Parameters: muls: " << muls_ <<" loss: "
210 << loss_ <<" matrixg "<< matrixg_ <<" lr "<< lr_
211 << " debug " << debug_ << " ntuple " << ntuple_
212 << " activeonly "<< activeonly_ << endreq;
213
228
229 setDchisqCut();
230 // Delete properly the geometry objects if already existing
231 clean();
232 log << MSG::INFO << ".....building Mdc " << endreq;
233
234 // Set objects and material properties for Mdc detector :
235 //setMaterial_Mdc();
236 //setCylinder_Mdc();
237
239 // initialize the MdcCalibFunSvc
241 //
242 // // initialize the MdcGeomSvc
243 // setGeomSvc_init();
244 //getEventStarTime();
245 // // Wires, Layers and SuperLayers of Mdc :
246 // set_Mdc();
247 // define histograms and Ntuples
248 hist_def();
249
250
251 IMagneticFieldSvc* IMFSvc;
252 StatusCode sc = service ("MagneticFieldSvc",IMFSvc);
253 if(sc!=StatusCode::SUCCESS) {
254 log << MSG::ERROR << "Unable to open Magnetic field service"<<endreq;
255 }
257
258 // Nominal magnetic field :
260 KalFitTrack::Bznom_ = (IMFSvc->getReferField())*10000; //unit is KGauss
262
263 if(4 == debug_){
264 std::cout<<" initialize, referField from MagneticFieldSvc: "<< (IMFSvc->getReferField())*10000 <<std::endl;
265 std::cout<<" magnetic field: "<<KalFitTrack::Bznom_<<std::endl;
266 }
267
268 }
269
270 // Print out of the status of the flags :
271 if (ntuple_)
272 log << MSG::INFO <<" ntuple out, the option is "<< ntuple_ <<endreq;
273 if (debug_ >0 ) {
274 cout << "KalFitAlg> DEBUG open,Here is the important Parameters :\n";
275 cout << " Leading particule with mass hyp = " << lead_ << std::endl;
276 cout << " mhyp = " << mhyp_ << std::endl;
277 cout << "===== Effects taking into account : " << std::endl;
278 cout << " - multiple scattering = " << muls_ << std::endl;
279 cout << " - energy loss = " << loss_ << std::endl;
281 cout << " - straggling for the energy loss " << std::endl;
282 cout << " - nominal Bz value = " << KalFitTrack::Bznom_ << std::endl;
283
284 if (KalFitTrack::numf_ > 19)
285 cout << " - non uniform magnetic field treatment "
286 << KalFitTrack::numf_ << std::endl;
287 cout << " - wire sag correction = " << wsag_ << std::endl;
288 cout << " - Tof correction = " << KalFitTrack::Tof_correc_ << std::endl;
289 cout << " - chi2 cut for each hit = " << KalFitTrack::chi2_hitf_
290 << std::endl << " is applied after " << KalFitTrack::nmdc_hit2_
291 << " hits included " << std::endl;
292
293 if (back_){
294 cout << " Backward filter is on with a pT cut value = " << pT_ << endl;
295 }
296 if(debug_ == 4) cout << " pathl = " << pathl_ << std::endl;
297
298 if (KalFitTrack::LR_==1)
299 cout << " Decision L/R from MdcRecHit " << std::endl;
300 }
301
307 // Get the Particle Properties Service
308 IPartPropSvc* p_PartPropSvc;
309 static const bool CREATEIFNOTTHERE(true);
310 StatusCode PartPropStatus = service("PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE);
311 if (!PartPropStatus.isSuccess() || 0 == p_PartPropSvc) {
312 log << MSG::WARNING << " Could not initialize Particle Properties Service" << endreq;
313 return StatusCode::SUCCESS;
314 }
315 m_particleTable = p_PartPropSvc->PDT();
316
317 return StatusCode::SUCCESS;
318}
void setCalibSvc_init(void)
initialize for the services
Definition: KalFitAlg2.cxx:247
void setBesFromGdml(void)
void setDchisqCut(void)
Definition: KalFitAlg.cxx:658
void hist_def(void)
hist definition
Definition: KalFitAlg.cxx:369
static int lead(void)
Magnetic field map.
static double chi2_hitf_
Cut chi2 for each hit.
static int back(void)
static int nmdc_hit2_
Cut chi2 for each hit.
static double factor_strag_
factor of energy loss straggling for electron
static int Tof_correc_
Flag for TOF correction.
static int numf_
Flag for treatment of non-uniform mag field.
static int drifttime_choice_
the drifttime choice
static int tprop_
for signal propagation correction
static int resol(void)
static void LR(int x)
static int numf(void)
static void setMagneticFieldSvc(IMagneticFieldSvc *)
static int LR_
Use L/R decision from MdcRecHit information :
static int strag_
Flag to take account of energy loss straggling :

◆ initialize() [2/2]

StatusCode KalFitAlg::initialize ( )

initialize

◆ innerwall() [1/6]

void KalFitAlg::innerwall ( KalFitTrack track,
int  l_mass,
int  way,
double  r1,
double  r2,
int &  index 
)

Definition at line 3261 of file KalFitAlg.cxx.

3261 {
3262 if (debug_ ==4) cout<<"innerwall....."<<endl;
3263 double ri=(r1<r2)?r1:r2;
3264 double ro=(r1<r2)?r2:r1;
3265 double Rmin,Rmax;
3266 int step;
3267 vector<KalFitCylinder>::iterator it;
3268 vector<KalFitCylinder>::iterator itStart;
3269 vector<KalFitCylinder>::iterator itStop;
3270 if(way<0){
3271 step=-1;
3272 itStart=_BesKalmanFitWalls.end()-index-1;
3273 itStop =_BesKalmanFitWalls.begin()-1;
3274 }
3275 else{
3276 step=1;
3277 itStart=_BesKalmanFitWalls.begin()+index;
3278 itStop =_BesKalmanFitWalls.end();
3279 }
3280 for(it=itStart; it != itStop; it=it+step) {
3281 if(ri < it->rmin() && it->radius() < ro) {
3282 it->updateTrack(track,way);
3283 Rmin=it->rmin();
3284 Rmax=it->radius();
3285 continue;
3286 }
3287 else if(it->rmin() <= ri && ri <= it->radius() && it->radius() < ro){
3288 it->updateTrack(track,way,ri,it->radius());
3289 Rmin=ri;
3290 Rmax=it->radius();
3291 if(way>0){
3292 //index = it - _BesKalmanFitWalls.begin();
3293 break;
3294 }
3295 else continue;
3296 }
3297 else if(ri < it->rmin() && it->rmin() <= ro && ro <= it->radius()){
3298 it->updateTrack(track,way,it->rmin(),ro);
3299 Rmin=it->rmin();
3300 Rmax=ro;
3301 if(way<0){
3302 //index = _BesKalmanFitWalls.end() - it;
3303 break;
3304 }
3305 else continue;
3306 }
3307 else if(it->radius()<ri || ro < it->rmin()){
3308 continue;
3309 }
3310 else {
3311 it->updateTrack(track,way,ri,ro);
3312 Rmin=ri;
3313 Rmax=ro;
3314 //index=it-_BesKalmanFitWalls.begin();
3315 break;
3316 }
3317 }
3318 if(way<0){
3319 //double phi=track.intersect_cylinder(Rmax);
3320 //HepPoint3D pivot=track.x(phi);
3321 //track.pivot_numf(pivot);
3322 track.pivot_numf(track.x(track.intersect_cylinder(Rmax)));
3323 index = _BesKalmanFitWalls.end() - it-1;
3324 }
3325 else{
3326 //double phi=track.intersect_cylinder(Rmin);
3327 //HepPoint3D pivot=track.x(phi);
3328 //track.pivot_numf(pivot);
3329 track.pivot_numf(track.x(track.intersect_cylinder(Rmin)));
3330 index = it - _BesKalmanFitWalls.begin();
3331 }
3332
3333}

◆ innerwall() [2/6]

void KalFitAlg::innerwall ( KalFitTrack track,
int  l_mass,
int  way,
double  r1,
double  r2,
int &  index 
)

◆ innerwall() [3/6]

void KalFitAlg::innerwall ( KalFitTrack trk,
int  l_mass,
int  way 
)

Take the inner walls (eloss and mult scat) into account.

Definition at line 3242 of file KalFitAlg.cxx.

3242 {
3243
3244 if (debug_ ==4) cout<<"innerwall....."<<endl;
3245 for(int i = 0; i < _BesKalmanFitWalls.size(); i++) {
3246 _BesKalmanFitWalls[i].updateTrack(track, way);
3247 if (debug_ == 4) cout<<"Wall "<<i<<" update the track!(filter)"<<endl;
3248 }
3249}

Referenced by Cgem_filter_anal(), complete_track(), and fitGemHits().

◆ innerwall() [4/6]

void KalFitAlg::innerwall ( KalFitTrack trk,
int  l_mass,
int  way 
)

Take the inner walls (eloss and mult scat) into account.

◆ innerwall() [5/6]

void KalFitAlg::innerwall ( KalFitTrack trk,
int  l_mass,
int  way,
int  begin,
int  end 
)

Definition at line 3251 of file KalFitAlg.cxx.

3251 {
3252 if (debug_ ==4) cout<<"innerwall....."<<endl;
3253 for(int i = begin; i <= end; i++) {
3254 _BesKalmanFitWalls[i].updateTrack(track, way);
3255 if(debug_ == 4){cout << "wall" << i << endl;
3256 cout <<"track" << "pivot=" << track.pivot() << "a=" << track.a() << "ea=" <<track.Ea() << endl;}
3257 if (debug_ == 4) cout<<"Wall "<<i<<" update the track!(filter)"<<endl;
3258 }
3259}

◆ innerwall() [6/6]

void KalFitAlg::innerwall ( KalFitTrack trk,
int  l_mass,
int  way,
int  begin,
int  end 
)

◆ kalman_fitting_anal() [1/2]

void KalFitAlg::kalman_fitting_anal ( void  )

very low momentum and very big costheta angle, use special initial error matrix

chose different initial error matrix

Definition at line 3340 of file KalFitAlg.cxx.

3341{
3342
3343 //cout<<"kalman_fitting_anal deal with a new event"<<endl;//wangll
3344
3345 MsgStream log(msgSvc(), name());
3346 double Pt_threshold(0.3);
3347 Hep3Vector IP(0,0,0);
3348 vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
3349 vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
3350 vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();
3351
3352 // Table Manager
3353 if ( !&whMgr ) return;
3354
3355 // Get reduced chi**2 of Mdc track :
3356 int ntrk = mdcMgr->size();
3357 double* rPt = new double[ntrk];
3358 int* rOM = new int[ntrk];
3359 unsigned int* order = new unsigned int[ntrk];
3360 unsigned int* rCont = new unsigned int[ntrk];
3361 unsigned int* rGen = new unsigned int[ntrk];
3362
3363 if(testOutput) cout<<"nMdcTrk = "<<ntrk<<endl;
3364
3365 int index = 0;
3366 for(vector<MdcRec_trk>::iterator it = mdcMgr->begin(),
3367 end = mdcMgr->end(); it != end; it++) {
3368 // Pt
3369 rPt[index] = 0;
3370 if (it->helix[2])
3371 rPt[index] = 1 / fabs(it->helix[2]);
3372 if(debug_ == 4) cout<<"rPt...[ "<<index<<" ]...."<< rPt[index] <<endl;
3373 if(rPt[index] < 0) rPt[index] = DBL_MAX;
3374 // Outermost layer
3375 std::vector<MdcRec_wirhit*> pt = it->hitcol ;
3376 if(debug_ == 4) cout<<"ppt size: "<< pt.size()<<endl;
3377 int outermost(-1);
3378 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
3379 ii !=pt.begin()-1; ii--) {
3380 int lyr((*ii)->geo->Lyr()->Id());
3381 if (outermost < lyr) outermost = lyr;
3382 if(debug_ == 4) cout<<"outmost: "<<outermost<<" lyr: "<<lyr<<endl;
3383 }
3384 rOM[index] = outermost;
3385 order[index] = index;
3386 ++index;
3387 }
3388
3389 // Sort Mdc tracks by Pt
3390 for (int j, k = ntrk - 1; k >= 0; k = j){
3391 j = -1;
3392 for(int i = 1; i <= k; i++)
3393 if(rPt[i - 1] < rPt[i]){
3394 j = i - 1;
3395 std::swap(order[i], order[j]);
3396 std::swap(rPt[i], rPt[j]);
3397 std::swap(rOM[i], rOM[j]);
3398 std::swap(rCont[i], rCont[j]);
3399 std::swap(rGen[i], rGen[j]);
3400 }
3401 }
3402 delete [] rPt;
3403
3404 //
3405 int newcount(0);
3406 //check whether Recon already registered
3407 DataObject *aReconEvent;
3408 eventSvc()->findObject("/Event/Recon",aReconEvent);
3409 if(!aReconEvent) {
3410 // register ReconEvent Data Object to TDS;
3411 ReconEvent* recevt = new ReconEvent;
3412 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
3413 if(sc!=StatusCode::SUCCESS) {
3414 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
3415 return;
3416 }
3417 }
3418
3419 RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;
3421 //make RecMdcKalTrackCol
3422 log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;
3423 // Loop over tracks given by trasan :
3424 for(int l = 0; l < ntrk; l++) {
3425
3426 //cout<<"----------------"<<endl;//wangll
3427 //cout<<"track "<<l<<" : "<<endl;//wangll
3428 nTotalTrks++;
3429
3430 for(int i=0; i<5; i++) iqual_front_[i] = 1; // wangll 2010-11-01
3431
3432 // m_timer[3]->start();
3433 MdcRec_trk& TrasanTRK = *(mdcMgr->begin() + order[l]);
3434 MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin()+order[l]);
3435
3436 // Reject the ones with quality != 0
3437 int trasqual = TrasanTRK_add.quality;
3438 if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl;
3439 if (trasqual) continue;
3440
3441 newcount++;
3442 if (debug_ == 4)
3443 cout << "******* KalFit NUMBER : " << newcount << std::endl;
3444
3445 // What kind of KalFit ?
3446 int type(0);
3447 if ((TrasanTRK_add.decision & 32) == 32 ||
3448 (TrasanTRK_add.decision & 64) == 64) type = 1;
3449
3450 // Initialisation : (x, a, ea)
3451 HepPoint3D x(TrasanTRK.pivot[0],
3452 TrasanTRK.pivot[1],
3453 TrasanTRK.pivot[2]);
3454
3455 HepVector a(5);
3456 for(int i = 0; i < 5; i++)
3457 a[i] = TrasanTRK.helix[i];
3458
3459 HepSymMatrix ea(5);
3460 for(int i = 0, k = 0; i < 5; i++) {
3461 for(int j = 0; j <= i; j++) {
3462 ea[i][j] = matrixg_*TrasanTRK.error[k++];
3463 ea[j][i] = ea[i][j];
3464 }
3465 }
3466 double fiTerm = TrasanTRK.fiTerm;
3467 int way(1);
3468 // Prepare the track found :
3469 KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
3470
3471 track_lead.bFieldZ(KalFitTrack::Bznom_);
3472
3473 // Mdc Hits
3474 int inlyr(999), outlyr(-1);
3475 int* rStat = new int[43];
3476 for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
3477 std::vector<MdcRec_wirhit*> pt=TrasanTRK.hitcol;
3478 int hit_in(0);
3479 if(debug_ == 4) cout<<"*********Pt size****"<< pt.size()<<endl;
3480 // Number of hits/layer
3481 int Num[43] = {0};
3482 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
3483 ii != pt.begin()-1; ii--) {
3484 Num[(*ii)->geo->Lyr()->Id()]++;
3485 }
3486 int hit_asso(0);
3487 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
3488 ii != pt.begin()-1; ii--) {
3489 hit_asso++;
3490 if (Num[(*ii)->geo->Lyr()->Id()]>3) {
3491 if (debug_ >0)
3492 cout << "WARNING: I found " << Num[(*ii)->geo->Lyr()->Id()]
3493 << " hits in the layer "
3494 << (*ii)->geo->Lyr()->Id() << std::endl;
3495 continue;
3496 }
3497 // if(ii!=pt.end()-1){
3498 // int layer_before=(*(ii+1))->geo->Lyr()->Id();
3499 // if(layer_before == (*ii)->geo->Lyr()->Id()){
3500 // MdcRec_wirhit * rechit_before = *(ii+1);
3501 // if((*rechit_before).rechitptr->getDriftT()>450 || (**ii).rechitptr->getDriftT()>450.){
3502 // if((*rechit_before).tdc < (**ii).tdc) continue;
3503 // else if(track_lead.HitsMdc().size()>0 && rStat[layer_before]){
3504 // track_lead.HitsMdc().pop_back();
3505 // }
3506 // }
3507 // }
3508 // }
3509
3510 hit_in++;
3511 MdcRec_wirhit & rechit = **ii;
3512 double dist[2] = {rechit.ddl, rechit.ddr};
3513 double erdist[2] = {rechit.erddl, rechit.erddr};
3514 const MdcGeoWire* geo = rechit.geo;
3515
3516 int lr_decision(0);
3517 if (KalFitTrack::LR_ == 1){
3518 if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
3519 // if (rechit.lr==0) lr_decision=-1;
3520 else if (rechit.lr==1) lr_decision=1;
3521 }
3522
3523 int ind(geo->Lyr()->Id());
3524
3525 // ATTENTION HERE!!!
3526 track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
3527 lr_decision, rechit.tdc,
3528 dist, erdist,
3529 _wire+(geo->Id()), rechit.rechitptr));
3530 // inner/outer layer :
3531 rStat[ind]++;
3532 if (inlyr>ind) inlyr = ind;
3533 if (outlyr<ind) outlyr = ind;
3534 }
3535 if (debug_ == 4)
3536 cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
3537
3538 // Empty layers :
3539 int empty_between(0), empty(0);
3540 for (int i= inlyr; i <= outlyr; i++)
3541 if (!rStat[i]) empty_between++;
3542 empty = empty_between+inlyr+(42-outlyr);
3543 delete [] rStat;
3544
3545 // RMK high momentum track under study, probably not neeeded...
3546 track_lead.order_wirhit(1);
3547 //track_lead.order_hits();
3548
3549 for(std::vector<KalFitHitMdc>::iterator it_hit = track_lead.HitsMdc().begin(); it_hit!=track_lead.HitsMdc().end(); it_hit++){
3550 //std::cout<<" the id of this hits after sorting in PatRec is "<<it_hit->id()<<std::endl;
3551 //std::cout<<" the layerid of the hit is "<<it_hit->wire().layer().layerId()<<std::endl;
3552 //std::cout<<" the cellid of this wire is "<<it_hit->wire().localId()<<std::endl;
3553 }
3554
3555 track_lead.type(type);
3556 track_lead.trasan_id(TrasanTRK.id);
3557 unsigned int nhit = track_lead.HitsMdc().size();
3558 if (!nhit && debug_ == 4) {
3559 cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
3560 continue;
3561 }
3562
3563 // Initialisation :
3564 double KalFitst(0), KalFitax(0), KalFitschi2(0);
3565 // Move to the outer hit :
3566
3567 Hep3Vector outer_pivot(track_lead.x(fiTerm));
3568
3569 track_lead.pivot(outer_pivot);
3570
3571 track_lead.bFieldZ(KalFitTrack::Bznom_);
3572 // attention best_chi2 reinitialize !!!
3573 if (nhit>=3 && !KalFitTrack::LR_)
3574 start_seed(track_lead, lead_, way, TrasanTRK);
3575 HepSymMatrix Eakal(5,0);
3576
3577 /// very low momentum and very big costheta angle, use special initial error matrix
3578 double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
3579 if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
3580 choice_ = 6;
3581 }
3582
3583 /// chose different initial error matrix
3584 init_matrix(choice_,TrasanTRK, Eakal);
3585
3586
3587 if (debug_ == 4){
3588 cout << "from Mdc Pattern Recognition: " << std::endl;
3589 HepPoint3D IP(0,0,0);
3590 Helix work(track_lead.pivot(),
3591 track_lead.a(),
3592 track_lead.Ea());
3593 work.pivot(IP);
3594 cout << " dr = " << work.a()[0]
3595 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
3596 cout << " phi0 = " << work.a()[1]
3597 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
3598 cout << " PT = " << 1/work.a()[2]
3599 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
3600 cout << " dz = " << work.a()[3]
3601 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
3602 cout << " tanl = " << work.a()[4]
3603 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
3604 }
3605
3606 if(testOutput) {
3607 cout<<"----------------------"<<endl;//660a
3608 cout<<"track "<<l<<", pid = "<<lead_<<": "<<endl;
3609 //int n_hits=(*itRecMdcTrack)->getNhits();
3610 //int n_hit_Axis=n_hits-(*itRecMdcTrack)->nster();
3611 //cout<<"nMdcHits,nMdcHitsAxis = "<<n_hits<<", "<<n_hit_Axis<<endl;//660a
3612 //cout<<"----------------------"<<endl;
3613 //cout<<"# old track par #"<<endl<<" pivot: "<<track.pivot()<<endl<<" helix: "<<track.a()<<endl<<" error: "<<track.Ea()<<endl;
3614 //cout<<"# true track par #"<<endl<<" helix: "<<mc_a<<endl;
3615 }
3616
3617
3618 filter_fwd_anal(track_lead, lead_, way, Eakal);
3619
3620 // std::cout<<" step3, track_lead.Ea: "<<track_lead.Ea()<<std::endl;
3621 track_lead.update_forMdc();
3622
3623 HepPoint3D IP(0,0,0);
3624 if (debug_ == 4) {
3625 cout << " Mdc FIRST KALMAN FIT " << std::endl;
3626 Helix work(track_lead.pivot(),
3627 track_lead.a(),
3628 track_lead.Ea());
3629 work.pivot(IP);
3630 cout << " dr = " << work.a()[0]
3631 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
3632 cout << " phi0 = " << work.a()[1]
3633 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
3634 cout << " PT = " << 1/work.a()[2]
3635 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
3636 cout << " dz = " << work.a()[3]
3637 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
3638 cout << " tanl = " << work.a()[4]
3639 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
3640 }
3641
3642 // fill TDS
3643 RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
3644 // Complete the track (other mass assumption, backward) and
3645 complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol,1);
3646 }
3647
3648
3649 IDataProviderSvc* eventSvc = NULL;
3650 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
3651 if (eventSvc) {
3652 log << MSG::INFO << "makeTds:event Svc has been found" << endreq;
3653 } else {
3654 log << MSG::FATAL << "makeTds:Could not find eventSvc" << endreq;
3655 return ;
3656 }
3657 StatusCode kalsc;
3658 IDataManagerSvc *dataManSvc;
3659 dataManSvc= dynamic_cast<IDataManagerSvc*>(eventSvc);
3660 DataObject *aKalTrackCol;
3661 eventSvc->findObject("/Event/Recon/RecMdcKalTrackCol",aKalTrackCol);
3662 if(aKalTrackCol != NULL) {
3663 dataManSvc->clearSubTree("/Event/Recon/RecMdcKalTrackCol");
3664 eventSvc->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
3665 }
3666 kalsc = eventSvc->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
3667 if( kalsc.isFailure() ) {
3668 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
3669 return ;
3670 }
3671 log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
3672 StatusCode segsc;
3673 //check whether the RecMdcKalHelixSegCol has been already registered
3674 DataObject *aRecKalSegEvent;
3675 eventSvc->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
3676 if(aRecKalSegEvent!=NULL) {
3677 //then unregister RecMdcKalHelixSegCol
3678 segsc = eventSvc->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
3679 if(segsc != StatusCode::SUCCESS) {
3680 log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
3681 return;
3682 }
3683 }
3684 segsc = eventSvc->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
3685 if( segsc.isFailure() ) {
3686 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
3687 return;
3688 }
3689 log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
3690
3691 double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
3692 double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0),tanl2(0.);
3693 double px1(0.),px2(0.),py1(0.),py2(0.),pz1(0.),pz2(0.),charge1(0.),charge2(0.);
3694
3695 //check the result:RecMdcKalTrackCol
3696 SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc,"/Event/Recon/RecMdcKalTrackCol");
3697 if (!kaltrkCol) {
3698 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
3699 return;
3700 }
3701 log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq;
3702 RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
3703 for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
3704 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
3705 << "Track Id: " << (*iter_trk)->getTrackId()
3706 << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
3707 << " Length of the track: "<< (*iter_trk)->getLength(2)
3708 << " Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
3709 << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
3710 <<" "<< (*iter_trk)->getChisq(1,2) << endreq
3711 << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,2)
3712 <<" "<< (*iter_trk)->getNdf(1,2) << endreq
3713 << "Kappa " << (*iter_trk)->getZHelix()[2]
3714 << endreq;
3715 for( int i = 0; i<43; i++) {
3716 log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
3717 << (*iter_trk)->getPathl(i) <<endreq;
3718 }
3719 if(ntuple_&1) {
3720 m_trackid = (*iter_trk)->getTrackId();
3721
3722 for( int jj =0, iii=0; jj<5; jj++) {
3723
3724 m_length[jj] = (*iter_trk)->getLength(jj);
3725 m_tof[jj] = (*iter_trk)->getTof(jj);
3726 m_nhits[jj] = (*iter_trk)->getNhits(jj);
3727 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
3728 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
3729 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
3730 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
3731 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
3732 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
3733 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
3734 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
3735 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
3736 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
3737 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
3738 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
3739 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
3740 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
3741 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
3742
3743 if(ntuple_&32) {
3744 for(int kk=0; kk<=jj; kk++,iii++) {
3745 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
3746 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
3747 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
3748 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
3749 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
3750 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
3751 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
3752 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
3753 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
3754 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
3755 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
3756 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
3757 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
3758 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
3759 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
3760 }
3761 }
3762 }
3763
3764 // // the following logic may seem peculiar, but it IS the case(for BOSS5.0 and BOSS5.1)
3765 // m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
3766 // m_chisq[0][1] = (*iter_trk)->getChisq(0,1);
3767 // m_chisq[1][0] = (*iter_trk)->getChisq(0,2);
3768 // m_chisq[1][1] = (*iter_trk)->getChisq(0,3);
3769 // m_chisq[2][0] = (*iter_trk)->getChisq(0,4);
3770 // m_chisq[2][1] = (*iter_trk)->getChisq(1,0);
3771 // m_chisq[3][0] = (*iter_trk)->getChisq(1,1);
3772 // m_chisq[3][1] = (*iter_trk)->getChisq(1,2);
3773 // m_chisq[4][0] = (*iter_trk)->getChisq(1,3);
3774 // m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
3775
3776 // m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
3777 // m_ndf[0][1] = (*iter_trk)->getNdf(0,1);
3778 // m_ndf[1][0] = (*iter_trk)->getNdf(0,2);
3779 // m_ndf[1][1] = (*iter_trk)->getNdf(0,3);
3780 // m_ndf[2][0] = (*iter_trk)->getNdf(0,4);
3781 // m_ndf[2][1] = (*iter_trk)->getNdf(1,0);
3782 // m_ndf[3][0] = (*iter_trk)->getNdf(1,1);
3783 // m_ndf[3][1] = (*iter_trk)->getNdf(1,2);
3784 // m_ndf[4][0] = (*iter_trk)->getNdf(1,3);
3785 // m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
3786
3787 // m_stat[0][0] = (*iter_trk)->getStat(0,0);
3788 // m_stat[0][1] = (*iter_trk)->getStat(0,1);
3789 // m_stat[1][0] = (*iter_trk)->getStat(0,2);
3790 // m_stat[1][1] = (*iter_trk)->getStat(0,3);
3791 // m_stat[2][0] = (*iter_trk)->getStat(0,4);
3792 // m_stat[2][1] = (*iter_trk)->getStat(1,0);
3793 // m_stat[3][0] = (*iter_trk)->getStat(1,1);
3794 // m_stat[3][1] = (*iter_trk)->getStat(1,2);
3795 // m_stat[4][0] = (*iter_trk)->getStat(1,3);
3796 // m_stat[4][1] = (*iter_trk)->getStat(1,4);
3797
3798 // RootConversion changed in BOSS6.0, so use thefollowing:
3799 m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
3800 m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
3801 m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
3802 m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
3803 m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
3804 m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
3805 m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
3806 m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
3807 m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
3808 m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
3809
3810 m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
3811 m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
3812 m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
3813 m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
3814 m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
3815 m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
3816 m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
3817 m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
3818 m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
3819 m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
3820
3821 m_stat[0][0] = (*iter_trk)->getStat(0,0);
3822 m_stat[1][0] = (*iter_trk)->getStat(0,1);
3823 m_stat[2][0] = (*iter_trk)->getStat(0,2);
3824 m_stat[3][0] = (*iter_trk)->getStat(0,3);
3825 m_stat[4][0] = (*iter_trk)->getStat(0,4);
3826 m_stat[0][1] = (*iter_trk)->getStat(1,0);
3827 m_stat[1][1] = (*iter_trk)->getStat(1,1);
3828 m_stat[2][1] = (*iter_trk)->getStat(1,2);
3829 m_stat[3][1] = (*iter_trk)->getStat(1,3);
3830 m_stat[4][1] = (*iter_trk)->getStat(1,4);
3831
3832 m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
3833 m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
3834 m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
3835 m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
3836 m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
3837
3838 m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
3839 m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
3840 m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
3841 m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
3842 m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
3843
3844 m_lpt = 1/m_lhelix[2];
3845 m_lpte = 1/m_lhelixe[2];
3846 m_lptmu = 1/m_lhelixmu[2];
3847 m_lptk = 1/m_lhelixk[2];
3848 m_lptp = 1/m_lhelixp[2];
3849
3850 m_fpt = 1/m_fhelix[2];
3851 m_fpte = 1/m_fhelixe[2];
3852 m_fptmu = 1/m_fhelixmu[2];
3853 m_fptk = 1/m_fhelixk[2];
3854 m_fptp = 1/m_fhelixp[2];
3855
3856 if(debug_ >= 3){
3857 std::cout<<" "<<std::endl;
3858 std::cout<<"in file Kalman_fitting_anal ,the m_fpt is .."<<m_fpt<<std::endl;
3859 std::cout<<"in file Kalman_fitting_anal ,the m_fpte is .."<<m_fpte<<std::endl;
3860 std::cout<<"in file Kalman_fitting_anal ,the m_fptmu is .."<<m_fptmu<<std::endl;
3861 std::cout<<"in file Kalman_fitting_anal ,the m_fptk is .."<<m_fptk<<std::endl;
3862 std::cout<<"in file Kalman_fitting_anal ,the m_fptp is .."<<m_fptp<<std::endl;
3863 }
3864
3865 m_zpt = 1/m_zhelix[2];
3866 m_zpte = 1/m_zhelixe[2];
3867 m_zptmu = 1/m_zhelixmu[2];
3868 m_zptk = 1/m_zhelixk[2];
3869 m_zptp = 1/m_zhelixp[2];
3870
3871 if(debug_ >= 3) {
3872 std::cout<<"in file Kalman_fitting_anal ,the m_zpt is .."<<m_zpt<<std::endl;
3873 std::cout<<"in file Kalman_fitting_anal ,the m_zpte is .."<<m_zpte<<std::endl;
3874 std::cout<<"in file Kalman_fitting_anal ,the m_zptmu is .."<<m_zptmu<<std::endl;
3875 std::cout<<"in file Kalman_fitting_anal ,the m_zptk is .."<<m_zptk<<std::endl;
3876 std::cout<<"in file Kalman_fitting_anal ,the m_zptp is .."<<m_zptp<<std::endl;
3877 }
3878 m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
3879 m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
3880 m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
3881 m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
3882 m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
3883
3884 if(debug_ >= 3) {
3885 std::cout<<"in file Kalman_fitting_anal ,the m_zptot is .."<<m_zptot<<std::endl;
3886 std::cout<<"in file Kalman_fitting_anal ,the m_zptote is .."<<m_zptote<<std::endl;
3887 std::cout<<"in file Kalman_fitting_anal ,the m_zptotmu is .."<<m_zptotmu<<std::endl;
3888 std::cout<<"in file Kalman_fitting_anal ,the m_zptotk is .."<<m_zptotk<<std::endl;
3889 std::cout<<"in file Kalman_fitting_anal ,the m_zptotp is .."<<m_zptotp<<std::endl;
3890 }
3891
3892 if(ntuple_&32) {
3893 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
3894 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
3895 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
3896 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
3897 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
3898 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
3899 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
3900 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
3901 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
3902 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
3903 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
3904 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
3905 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
3906 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
3907 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
3908 }
3909
3910 StatusCode sc1 = m_nt1->write();
3911 if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;
3912 }
3913
3914 if(ntuple_&4) {
3915 if(jj == 1) {
3916 phi1 = (*iter_trk)->getFFi0();
3917 r1 = (*iter_trk)->getFDr();
3918 z1 = (*iter_trk)->getFDz();
3919 kap1 = (*iter_trk)->getFCpa();
3920 tanl1 = (*iter_trk)->getFTanl();
3921 charge1 = kap1/fabs(kap1);
3922 x1 = r1*cos(phi1);
3923 y1 = r1*sin(phi1);
3924 p1 = sqrt(1+tanl1*tanl1)/kap1;
3925 the1 = M_PI/2-atan(tanl1);
3926 px1 = -sin(phi1)/fabs(kap1);
3927 py1 = cos(phi1)/fabs(kap1);
3928 pz1= tanl1/fabs(kap1);
3929
3930 } else if(jj == 2) {
3931 phi2 = (*iter_trk)->getFFi0();
3932 r2 = (*iter_trk)->getFDr();
3933 z2 = (*iter_trk)->getFDz();
3934 kap2 = (*iter_trk)->getFCpa();
3935 tanl2 = (*iter_trk)->getFTanl();
3936 charge2 = kap2/fabs(kap2);
3937 x2 = r1*cos(phi2);
3938 y2 = r1*sin(phi2);
3939 p2 = sqrt(1+tanl2*tanl2)/kap1;
3940 the2 = M_PI/2-atan(tanl2);
3941 px2 = -sin(phi2)/fabs(kap2);
3942 py2 = cos(phi2)/fabs(kap2);
3943 pz2= tanl2/fabs(kap2);
3944 }
3945 }
3946 }
3947 if(ntuple_&4) {
3948 m_delx = x1 - x2;
3949 m_dely = y1 - y2;
3950 m_delz = z1 - z2;
3951 m_delthe = the1 + the2;
3952 m_delphi = phi1- phi2;
3953 m_delp = p1 - p2;
3954 m_delpx = charge1*fabs(px1) + charge2*fabs(px2);
3955 m_delpy = charge1*fabs(py1) + charge2*fabs(py2);
3956 m_delpz = charge1*fabs(pz1) + charge2*fabs(pz2);
3957
3958 StatusCode sc2 = m_nt2->write();
3959 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;
3960 }
3961
3962 delete [] order;
3963 delete [] rCont;
3964 delete [] rGen;
3965 delete [] rOM;
3966
3967 if (debug_ == 4)
3968 cout << "Kalfitting finished " << std::endl;
3969 //cout << "kalman fitting end" << endl;
3970}
Double_t phi2
Double_t phi1
void complete_track(MdcRec_trk &TrasanTRK, MdcRec_trk_add &TrasanTRK_add, KalFitTrack &track_lead, RecMdcKalTrack *kaltrk, RecMdcKalTrackCol *kalcol, RecMdcKalHelixSegCol *segcol, int flagsmooth)
Definition: KalFitAlg.cxx:5612
void start_seed(KalFitTrack &track, int lead_, int way, MdcRec_trk &trk)
Definition: KalFitAlg.cxx:6120
void order_wirhit(int index)
void update_forMdc(void)
void appendHitsMdc(KalFitHitMdc h)
Functions for Mdc hits list.
double bFieldZ(double)
sets/returns z componet of the magnetic field.

Referenced by execute().

◆ kalman_fitting_anal() [2/2]

void KalFitAlg::kalman_fitting_anal ( void  )

◆ kalman_fitting_calib() [1/2]

void KalFitAlg::kalman_fitting_calib ( void  )

Definition at line 3972 of file KalFitAlg.cxx.

3973{
3974
3975 MsgStream log(msgSvc(), name());
3976 double Pt_threshold(0.3);
3977 Hep3Vector IP(0,0,0);
3978
3979 vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
3980 vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
3981 vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();
3982
3983 // Table Manager
3984 if ( !&whMgr ) return;
3985
3986 // Get reduced chi**2 of Mdc track :
3987 int ntrk = mdcMgr->size();
3988 double* rPt = new double[ntrk];
3989 int* rOM = new int[ntrk];
3990 unsigned int* order = new unsigned int[ntrk];
3991 unsigned int* rCont = new unsigned int[ntrk];
3992 unsigned int* rGen = new unsigned int[ntrk];
3993
3994 int index = 0;
3995 for(vector<MdcRec_trk>::iterator it = mdcMgr->begin(),
3996 end = mdcMgr->end(); it != end; it++) {
3997 // Pt
3998 rPt[index] = 0;
3999 if (it->helix[2])
4000 rPt[index] = 1 / fabs(it->helix[2]);
4001 if(debug_ == 4) cout<<"rPt...[ "<<index<<" ]...."<< rPt[index] <<endl;
4002 if(rPt[index] < 0) rPt[index] = DBL_MAX;
4003 // Outermost layer
4004 std::vector<MdcRec_wirhit*> pt = it->hitcol ;
4005 if(debug_ == 4) cout<<"ppt size: "<< pt.size()<<endl;
4006 int outermost(-1);
4007 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
4008 ii !=pt.begin()-1; ii--) {
4009 int lyr((*ii)->geo->Lyr()->Id());
4010 if (outermost < lyr) outermost = lyr;
4011 if(debug_ == 4) cout<<"outmost: "<<outermost<<" lyr: "<<lyr<<endl;
4012 }
4013 rOM[index] = outermost;
4014 order[index] = index;
4015 ++index;
4016 }
4017
4018 // Sort Mdc tracks by Pt
4019 for (int j, k = ntrk - 1; k >= 0; k = j){
4020 j = -1;
4021 for(int i = 1; i <= k; i++)
4022 if(rPt[i - 1] < rPt[i]){
4023 j = i - 1;
4024 std::swap(order[i], order[j]);
4025 std::swap(rPt[i], rPt[j]);
4026 std::swap(rOM[i], rOM[j]);
4027 std::swap(rCont[i], rCont[j]);
4028 std::swap(rGen[i], rGen[j]);
4029 }
4030 }
4031 delete [] rPt;
4032 //
4033 int newcount(0);
4034 //check whether Recon already registered
4035 DataObject *aReconEvent;
4036 eventSvc()->findObject("/Event/Recon",aReconEvent);
4037 if(!aReconEvent) {
4038 // register ReconEvent Data Object to TDS;
4039 ReconEvent* recevt = new ReconEvent;
4040 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
4041 if(sc!=StatusCode::SUCCESS) {
4042 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
4043 return;
4044 }
4045 }
4046
4047 RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;
4049 //make RecMdcKalTrackCol
4050 log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;
4051
4052 // Loop over tracks given by PatRecon :
4053 for(int l = 0; l < ntrk; l++) {
4054 // m_timer[3]->start();
4055 MdcRec_trk& TrasanTRK = *(mdcMgr->begin() + order[l]);
4056 MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin()+order[l]);
4057
4058 // Reject the ones with quality != 0
4059 int trasqual = TrasanTRK_add.quality;
4060 if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl;
4061 if (trasqual) continue;
4062
4063 newcount++;
4064 if (debug_ == 4)
4065 cout << "******* KalFit NUMBER : " << newcount << std::endl;
4066
4067 // What kind of KalFit ?
4068 int type(0);
4069 if ((TrasanTRK_add.decision & 32) == 32 ||
4070 (TrasanTRK_add.decision & 64) == 64) type = 1;
4071
4072 // Initialisation : (x, a, ea)
4073 HepPoint3D x(TrasanTRK.pivot[0],
4074 TrasanTRK.pivot[1],
4075 TrasanTRK.pivot[2]);
4076
4077 HepVector a(5);
4078 for(int i = 0; i < 5; i++)
4079 a[i] = TrasanTRK.helix[i];
4080
4081 HepSymMatrix ea(5);
4082 for(int i = 0, k = 0; i < 5; i++) {
4083 for(int j = 0; j <= i; j++) {
4084 ea[i][j] = matrixg_*TrasanTRK.error[k++];
4085 ea[j][i] = ea[i][j];
4086 }
4087 }
4088
4090
4091 double fiTerm = TrasanTRK.fiTerm;
4092 int way(1);
4093 // Prepare the track found :
4094 KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
4095 track_lead.bFieldZ(KalFitTrack::Bznom_);
4096 // Mdc Hits
4097 int inlyr(999), outlyr(-1);
4098 int* rStat = new int[43];
4099 for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
4100 std::vector<MdcRec_wirhit*> pt=TrasanTRK.hitcol;
4101 int hit_in(0);
4102 if(debug_ == 4) cout<<"*********Pt size****"<< pt.size()<<endl;
4103 // Number of hits/layer
4104 int Num[43] = {0};
4105 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
4106 ii != pt.begin()-1; ii--) {
4107 Num[(*ii)->geo->Lyr()->Id()]++;
4108 }
4109
4110 int hit_asso(0);
4111 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
4112 ii != pt.begin()-1; ii--) {
4113
4114 hit_asso++;
4115 if (Num[(*ii)->geo->Lyr()->Id()]>3) {
4116 if (debug_ >0)
4117 cout << "WARNING: I found " << Num[(*ii)->geo->Lyr()->Id()]
4118 << " hits in the layer "
4119 << (*ii)->geo->Lyr()->Id() << std::endl;
4120 continue;
4121 }
4122 // if(ii!=pt.end()-1){
4123 // if(42 == (*ii)->geo->Lyr()->Id() && 42 == (*(ii+1))->geo->Lyr()->Id()){
4124 // MdcRec_wirhit * rechit_before = *(ii+1);
4125 // if((*rechit_before).tdc < (**ii).tdc) continue;
4126 // else if(track_lead.HitsMdc().size()>0 && rStat[42]){
4127 // track_lead.HitsMdc().pop_back();
4128 // }
4129 // }
4130 // else{
4131 // int layer_before=(*(ii+1))->geo->Lyr()->Id();
4132 // if(layer_before == (*ii)->geo->Lyr()->Id()){
4133 // MdcRec_wirhit * rechit_before = *(ii+1);
4134 // if((*rechit_before).rechitptr->getDriftT()>450 || (**ii).rechitptr->getDriftT()>450.){
4135 // if((*rechit_before).tdc < (**ii).tdc) continue;
4136 // else if(track_lead.HitsMdc().size()>0 && rStat[layer_before]){
4137 // track_lead.HitsMdc().pop_back();
4138 // }
4139 // }
4140 // }
4141 // }
4142 // }
4143
4144 hit_in++;
4145 MdcRec_wirhit & rechit = **ii;
4146 double dist[2] = {rechit.ddl, rechit.ddr};
4147 double erdist[2] = {rechit.erddl, rechit.erddr};
4148 const MdcGeoWire* geo = rechit.geo;
4149
4150 int lr_decision(0);
4151 if (KalFitTrack::LR_ == 1){
4152 if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
4153 // if (rechit.lr==0) lr_decision=-1;
4154 else if (rechit.lr==1) lr_decision=1;
4155 }
4156
4157 int ind(geo->Lyr()->Id());
4158 track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
4159 lr_decision, rechit.tdc,
4160 dist, erdist,
4161 _wire+(geo->Id()), rechit.rechitptr));
4162 // inner/outer layer :
4163 rStat[ind]++;
4164 if (inlyr>ind) inlyr = ind;
4165 if (outlyr<ind) outlyr = ind;
4166 }
4167 if (debug_ == 4)
4168 cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
4169
4170 // Empty layers :
4171 int empty_between(0), empty(0);
4172 for (int i= inlyr; i <= outlyr; i++)
4173 if (!rStat[i]) empty_between++;
4174 empty = empty_between+inlyr+(42-outlyr);
4175 delete [] rStat;
4176
4177 // RMK high momentum track under study, probably not neeeded...
4178 track_lead.order_wirhit(1);
4179 track_lead.type(type);
4180 unsigned int nhit = track_lead.HitsMdc().size();
4181 if (!nhit && debug_ == 4) {
4182 cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
4183 continue;
4184 }
4185
4186 // Initialisation :
4187 double KalFitst(0), KalFitax(0), KalFitschi2(0);
4188 // Move to the outer most hit :
4189 Hep3Vector outer_pivot(track_lead.x(fiTerm));
4190
4191 if(debug_ == 4) {
4192 std::cout<<"before track_lead.pivot(outer_pivot) ,the error matrix of track_lead is .."<<track_lead.Ea()<<std::endl;
4193 }
4194 track_lead.pivot(outer_pivot); // hi gay, the error matrix is changed in this function!!
4195 track_lead.bFieldZ(KalFitTrack::Bznom_);
4196 // attention best_chi2 reinitialize !!!
4197 if (nhit>=3 && !KalFitTrack::LR_)
4198 start_seed(track_lead, lead_, way, TrasanTRK);
4199 HepSymMatrix Eakal(5,0);
4200
4201 //init_matrix(TrasanTRK, Eakal);
4202
4203 double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
4204 if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
4205 choice_ = 6;
4206 }
4207
4208 init_matrix(choice_,TrasanTRK, Eakal);
4209
4210 //std::cout<<" Eakal be here: "<<Eakal<<std::endl;
4211
4212 if (debug_ == 4){
4213 std::cout << "from Mdc Pattern Recognition: " << std::endl;
4214 HepPoint3D IP(0,0,0);
4215 Helix work(track_lead.pivot(),
4216 track_lead.a(),
4217 track_lead.Ea());
4218 work.pivot(IP);
4219 std::cout << " dr = " << work.a()[0]
4220 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
4221 std::cout << " phi0 = " << work.a()[1]
4222 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
4223 std::cout << " PT = " << 1/work.a()[2]
4224 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
4225 std::cout << " dz = " << work.a()[3]
4226 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
4227 std::cout << " tanl = " << work.a()[4]
4228 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
4229 }
4230
4231 filter_fwd_calib(track_lead, lead_, way, Eakal);
4232 track_lead.update_forMdc();
4233
4234 HepPoint3D IP(0,0,0);
4235 if (debug_ == 4) {
4236 cout << " Mdc FIRST KALMAN FIT " << std::endl;
4237 Helix work(track_lead.pivot(),
4238 track_lead.a(),
4239 track_lead.Ea());
4240 work.pivot(IP);
4241 cout << " dr = " << work.a()[0]
4242 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
4243 cout << " phi0 = " << work.a()[1]
4244 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
4245 cout << " PT = " << 1/work.a()[2]
4246 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
4247 cout << " dz = " << work.a()[3]
4248 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
4249 cout << " tanl = " << work.a()[4]
4250 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
4251 }
4252
4253 // fill TDS
4254 RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
4255
4256 // Complete the track (other mass assumption, backward) and
4257 complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol);
4258 }
4259
4260
4261 StatusCode kalsc;
4262 //check whether the RecMdcKalTrackCol has been already registered
4263 DataObject *aRecKalEvent;
4264 eventSvc()->findObject("/Event/Recon/RecMdcKalTrackCol", aRecKalEvent);
4265 if(aRecKalEvent!=NULL) {
4266 //then unregister RecMdcKalCol
4267 kalsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
4268 if(kalsc != StatusCode::SUCCESS) {
4269 log << MSG::FATAL << "Could not unregister RecMdcKalTrack collection" << endreq;
4270 return;
4271 }
4272 }
4273
4274 kalsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
4275 if( kalsc.isFailure()) {
4276 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
4277 return;
4278 }
4279 log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
4280
4281
4282
4283 StatusCode segsc;
4284 //check whether the RecMdcKalHelixSegCol has been already registered
4285 DataObject *aRecKalSegEvent;
4286 eventSvc()->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
4287 if(aRecKalSegEvent!=NULL) {
4288 //then unregister RecMdcKalHelixSegCol
4289 segsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
4290 if(segsc != StatusCode::SUCCESS) {
4291 log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
4292 return;
4293 }
4294 }
4295
4296 segsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
4297 if( segsc.isFailure() ) {
4298 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
4299 return;
4300 }
4301 log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
4302
4303
4304 double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
4305 double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0.),tanl2(0.);
4306 //check the result:RecMdcKalTrackCol
4307
4308 SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
4309 if (!kaltrkCol) {
4310 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
4311 return;
4312 }
4313 log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq;
4314 RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
4315 for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
4316 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
4317 << "Track Id: " << (*iter_trk)->getTrackId()
4318 << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
4319 << " Length of the track: "<< (*iter_trk)->getLength(2)
4320 << " Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
4321 << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
4322 <<" "<< (*iter_trk)->getChisq(1,2) << endreq
4323 << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,1)
4324 <<" "<< (*iter_trk)->getNdf(1,2) << endreq
4325 << "Kappa " << (*iter_trk)->getZHelix()[2]
4326 << endreq;
4327
4328 HelixSegRefVec gothelixsegs = (*iter_trk)->getVecHelixSegs();
4329 if(debug_ == 4) {
4330 std::cout<<"the size of gothelixsegs ..."<<gothelixsegs.size()<<std::endl;
4331 }
4332
4333 HelixSegRefVec::iterator it_gothelixseg = gothelixsegs.begin();
4334 for( ; it_gothelixseg != gothelixsegs.end(); it_gothelixseg++) {
4335 if(debug_ == 4) {
4336 std::cout<<"the layerId of this helixseg is ..."<<(*it_gothelixseg)->getLayerId()<<std::endl;
4337 std::cout<<"the residual of this helixseg exclude the meas hit"<<(*it_gothelixseg)->getResExcl()<<std::endl;
4338 std::cout<<"the residual of this helixseg include the meas hit"<<(*it_gothelixseg)->getResIncl()<<std::endl;
4339 std::cout<<"the track id of the helixseg is ..."<<(*it_gothelixseg)->getTrackId() <<std::endl;
4340 std::cout<<"the tof of the helixseg is ..."<<(*it_gothelixseg)->getTof()<<std::endl;
4341 std::cout<<"the Zhit of the helixseg is ..."<<(*it_gothelixseg)->getZhit()<<std::endl;
4342 }
4343 }
4344 for( int i = 0; i<43; i++) {
4345 log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
4346 << (*iter_trk)->getPathl(i) <<endreq;
4347 }
4348
4349 if(ntuple_&1) {
4350 m_trackid = (*iter_trk)->getTrackId();
4351 for( int jj =0, iii=0; jj<5; jj++) {
4352 m_length[jj] = (*iter_trk)->getLength(jj);
4353 m_tof[jj] = (*iter_trk)->getTof(jj);
4354 m_nhits[jj] = (*iter_trk)->getNhits(jj);
4355 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
4356 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
4357 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
4358 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
4359 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
4360 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
4361 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
4362 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
4363 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
4364 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
4365 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
4366 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
4367 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
4368 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
4369 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
4370 if(ntuple_&32) {
4371 for(int kk=0; kk<=jj; kk++,iii++) {
4372 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
4373 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
4374 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
4375 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
4376 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
4377 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
4378 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
4379 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
4380 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
4381 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
4382 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
4383 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
4384 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
4385 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
4386 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
4387 }
4388
4389 }
4390 }
4391
4392 // // the following logic may seem peculiar, but it IS the case(for BOSS5.0 and BOSS5.1)
4393 // m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
4394 // m_chisq[0][1] = (*iter_trk)->getChisq(0,1);
4395 // m_chisq[1][0] = (*iter_trk)->getChisq(0,2);
4396 // m_chisq[1][1] = (*iter_trk)->getChisq(0,3);
4397 // m_chisq[2][0] = (*iter_trk)->getChisq(0,4);
4398 // m_chisq[2][1] = (*iter_trk)->getChisq(1,0);
4399 // m_chisq[3][0] = (*iter_trk)->getChisq(1,1);
4400 // m_chisq[3][1] = (*iter_trk)->getChisq(1,2);
4401 // m_chisq[4][0] = (*iter_trk)->getChisq(1,3);
4402 // m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
4403
4404 // m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
4405 // m_ndf[0][1] = (*iter_trk)->getNdf(0,1);
4406 // m_ndf[1][0] = (*iter_trk)->getNdf(0,2);
4407 // m_ndf[1][1] = (*iter_trk)->getNdf(0,3);
4408 // m_ndf[2][0] = (*iter_trk)->getNdf(0,4);
4409 // m_ndf[2][1] = (*iter_trk)->getNdf(1,0);
4410 // m_ndf[3][0] = (*iter_trk)->getNdf(1,1);
4411 // m_ndf[3][1] = (*iter_trk)->getNdf(1,2);
4412 // m_ndf[4][0] = (*iter_trk)->getNdf(1,3);
4413 // m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
4414
4415 // m_stat[0][0] = (*iter_trk)->getStat(0,0);
4416 // m_stat[0][1] = (*iter_trk)->getStat(0,1);
4417 // m_stat[1][0] = (*iter_trk)->getStat(0,2);
4418 // m_stat[1][1] = (*iter_trk)->getStat(0,3);
4419 // m_stat[2][0] = (*iter_trk)->getStat(0,4);
4420 // m_stat[2][1] = (*iter_trk)->getStat(1,0);
4421 // m_stat[3][0] = (*iter_trk)->getStat(1,1);
4422 // m_stat[3][1] = (*iter_trk)->getStat(1,2);
4423 // m_stat[4][0] = (*iter_trk)->getStat(1,3);
4424 // m_stat[4][1] = (*iter_trk)->getStat(1,4);
4425
4426 // RootConversion changed in BOSS6.0, so use thefollowing:
4427 m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
4428 m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
4429 m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
4430 m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
4431 m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
4432 m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
4433 m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
4434 m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
4435 m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
4436 m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
4437
4438 m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
4439 m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
4440 m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
4441 m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
4442 m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
4443 m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
4444 m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
4445 m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
4446 m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
4447 m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
4448
4449 m_stat[0][0] = (*iter_trk)->getStat(0,0);
4450 m_stat[1][0] = (*iter_trk)->getStat(0,1);
4451 m_stat[2][0] = (*iter_trk)->getStat(0,2);
4452 m_stat[3][0] = (*iter_trk)->getStat(0,3);
4453 m_stat[4][0] = (*iter_trk)->getStat(0,4);
4454 m_stat[0][1] = (*iter_trk)->getStat(1,0);
4455 m_stat[1][1] = (*iter_trk)->getStat(1,1);
4456 m_stat[2][1] = (*iter_trk)->getStat(1,2);
4457 m_stat[3][1] = (*iter_trk)->getStat(1,3);
4458 m_stat[4][1] = (*iter_trk)->getStat(1,4);
4459
4460 m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
4461 m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
4462 m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
4463 m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
4464 m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
4465
4466 m_zpt = 1/m_zhelix[2];
4467 m_zpte = 1/m_zhelixe[2];
4468 m_zptmu = 1/m_zhelixmu[2];
4469 m_zptk = 1/m_zhelixk[2];
4470 m_zptp = 1/m_zhelixp[2];
4471
4472 m_fpt = 1/m_fhelix[2];
4473 m_fpte = 1/m_fhelixe[2];
4474 m_fptmu = 1/m_fhelixmu[2];
4475 m_fptk = 1/m_fhelixk[2];
4476 m_fptp = 1/m_fhelixp[2];
4477
4478 m_lpt = 1/m_lhelix[2];
4479 m_lpte = 1/m_lhelixe[2];
4480 m_lptmu = 1/m_lhelixmu[2];
4481 m_lptk = 1/m_lhelixk[2];
4482 m_lptp = 1/m_lhelixp[2];
4483
4484 m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
4485 m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
4486 m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
4487 m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
4488 m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
4489
4490 m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
4491 m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
4492 m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
4493 m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
4494 m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
4495 if(ntuple_&32) {
4496 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
4497 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
4498 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
4499 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
4500 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
4501 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
4502 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
4503 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
4504 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
4505 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
4506 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
4507 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
4508 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
4509 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
4510 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
4511 }
4512
4513 StatusCode sc1 = m_nt1->write();
4514 if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;
4515 }
4516
4517 if(ntuple_&4) {
4518 if(jj == 1) {
4519 phi1 = (*iter_trk)->getFFi0();
4520 r1 = (*iter_trk)->getFDr();
4521 z1 = (*iter_trk)->getFDz();
4522 kap1 = (*iter_trk)->getFCpa();
4523 tanl1 = (*iter_trk)->getFTanl();
4524 x1 = r1*cos(phi1);
4525 y1 = r1*sin(phi1);
4526 p1 = sqrt(1+tanl1*tanl1)/kap1;
4527 the1 = M_PI/2-atan(tanl1);
4528 } else if(jj == 2) {
4529 phi2 = (*iter_trk)->getFFi0();
4530 r2 = (*iter_trk)->getFDr();
4531 z2 = (*iter_trk)->getFDz();
4532 kap2 = (*iter_trk)->getFCpa();
4533 tanl2 = (*iter_trk)->getFTanl();
4534 x2 = r1*cos(phi2);
4535 y2 = r1*sin(phi2);
4536 p2 = sqrt(1+tanl2*tanl2)/kap1;
4537 the2 = M_PI/2-atan(tanl2);
4538 }
4539 }
4540 }
4541 if(ntuple_&4) {
4542 m_delx = x1 - x2;
4543 m_dely = y1 - y2;
4544 m_delz = z1 - z2;
4545 m_delthe = the1 + the2;
4546 m_delphi = phi1- phi2;
4547 m_delp = p1 - p2;
4548 StatusCode sc2 = m_nt2->write();
4549 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;
4550 }
4551 delete [] order;
4552 delete [] rCont;
4553 delete [] rGen;
4554 delete [] rOM;
4555
4556 if (debug_ == 4)
4557 cout << "Kalfitting finished " << std::endl;
4558}
static void setInitMatrix(HepSymMatrix m)

Referenced by execute().

◆ kalman_fitting_calib() [2/2]

void KalFitAlg::kalman_fitting_calib ( void  )

◆ kalman_fitting_csmalign() [1/2]

void KalFitAlg::kalman_fitting_csmalign ( void  )

Definition at line 5050 of file KalFitAlg.cxx.

5051{
5052
5053 MsgStream log(msgSvc(), name());
5054 double Pt_threshold(0.3);
5055 Hep3Vector IP(0,0,0);
5056
5057 vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
5058 vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
5059 vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();
5060
5061 // Table Manager
5062 if ( !&whMgr ) return;
5063
5064 // Get reduced chi**2 of Mdc track :
5065 int ntrk = mdcMgr->size();
5066 //cout<<"ntrk: "<<ntrk<<endl;
5067
5068 int nhits = whMgr->size();
5069 //cout<<"nhits: "<<nhits<<endl;
5070
5071
5072 double* rY = new double[ntrk];
5073 double* rfiTerm = new double[ntrk];
5074 double* rPt = new double[ntrk];
5075 int* rOM = new int[ntrk];
5076 unsigned int* order = new unsigned int[ntrk];
5077 unsigned int* rCont = new unsigned int[ntrk];
5078 unsigned int* rGen = new unsigned int[ntrk];
5079
5080 int index = 0;
5081 Hep3Vector csmp3[2];
5082 for(vector<MdcRec_trk>::iterator it = mdcMgr->begin(),
5083 end = mdcMgr->end(); it != end; it++) {
5084 //order by phi term
5085 rfiTerm[index]=it->fiTerm;
5086 //cout<<"fiTerm: "<<rfiTerm[index]<<endl;
5087 // Pt
5088 rPt[index] = 0;
5089 if (it->helix[2])
5090 rPt[index] = 1 / fabs(it->helix[2]);
5091 if(debug_ == 4) cout<<"rPt...[ "<<index<<" ]...."<< rPt[index] <<endl;
5092 if(rPt[index] < 0) rPt[index] = DBL_MAX;
5093 // Outermost layer
5094 std::vector<MdcRec_wirhit*> pt = it->hitcol ;
5095 if(debug_ == 4) cout<<"ppt size: "<< pt.size()<<endl;
5096 int outermost(-1);
5097 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
5098 ii !=pt.begin()-1; ii--) {
5099 int lyr((*ii)->geo->Lyr()->Id());
5100 if (outermost < lyr) {
5101 outermost = lyr;
5102 rY[index] = (*ii)->geo->Forward().y();
5103 }
5104 if(debug_ == 4) cout<<"outmost: "<<outermost<<" lyr: "<<lyr<<endl;
5105 }
5106 rOM[index] = outermost;
5107 order[index] = index;
5108 ++index;
5109 }
5110
5111 // Sort Mdc tracks by fiTerm
5112 for (int j, k = ntrk - 1; k >= 0; k = j){
5113 j = -1;
5114 for(int i = 1; i <= k; i++)
5115 if(rY[i - 1] < rY[i]){
5116 j = i - 1;
5117 std::swap(order[i], order[j]);
5118 std::swap(rY[i], rY[j]);
5119 std::swap(rOM[i], rOM[j]);
5120 std::swap(rCont[i], rCont[j]);
5121 std::swap(rGen[i], rGen[j]);
5122 }
5123 }
5124 delete [] rPt;
5125 delete [] rY;
5126 delete [] rfiTerm;
5127 //
5128 int newcount(0);
5129 //check whether Recon already registered
5130 DataObject *aReconEvent;
5131 eventSvc()->findObject("/Event/Recon",aReconEvent);
5132 if(!aReconEvent) {
5133 // register ReconEvent Data Object to TDS;
5134 ReconEvent* recevt = new ReconEvent;
5135 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
5136 if(sc!=StatusCode::SUCCESS) {
5137 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
5138 return;
5139 }
5140 }
5141
5142 RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;
5144 //make RecMdcKalTrackCol
5145 log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;
5146
5147 // m_timer[3]->start();
5148 // MdcRec_trk& TrasanTRK;
5149 // MdcRec_trk_add& TrasanTRK_add;
5150
5151 // for(int l = 0; l < ntrk; l++) {
5152 MdcRec_trk& TrasanTRK = *(mdcMgr->begin() + order[1]);
5153 MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin()+order[1]);
5154 // Reject the ones with quality != 0
5155 // int trasqual = TrasanTRK_add.quality;
5156 // if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl;
5157 // if (trasqual) continue;
5158
5159 newcount++;
5160 if (debug_ == 4)
5161 cout << "******* KalFit NUMBER : " << newcount << std::endl;
5162
5163 // What kind of KalFit ?
5164 int type(0);
5165 if ((TrasanTRK_add.decision & 32) == 32 ||
5166 (TrasanTRK_add.decision & 64) == 64) type = 1;
5167
5168 // Initialisation : (x, a, ea)
5169 HepPoint3D x(TrasanTRK.pivot[0],
5170 TrasanTRK.pivot[1],
5171 TrasanTRK.pivot[2]);
5172
5173 HepVector a(5);
5174 for(int i = 0; i < 5; i++)
5175 a[i] = TrasanTRK.helix[i];
5176
5177 HepSymMatrix ea(5);
5178 for(int i = 0, k = 0; i < 5; i++) {
5179 for(int j = 0; j <= i; j++) {
5180 ea[i][j] = matrixg_*TrasanTRK.error[k++];
5181 ea[j][i] = ea[i][j];
5182 }
5183 }
5184
5186
5187 double fiTerm = TrasanTRK.fiTerm;
5188 int way(1);
5189 // Prepare the track found :
5190 KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
5191 track_lead.bFieldZ(KalFitTrack::Bznom_);
5192
5193 int hit_asso(0);
5194 for(int l = 0; l < ntrk; l++) {
5195 MdcRec_trk& TrasanTRK1 = *(mdcMgr->begin() + order[l]);
5196 MdcRec_trk_add& TrasanTRK_add1 = *(mdc_addMgr->begin()+order[l]);
5197 // Reject the ones with quality != 0
5198 int trasqual = TrasanTRK_add1.quality;
5199 if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl;
5200 if (trasqual) continue;
5201 // Mdc Hits
5202 int inlyr(999), outlyr(-1);
5203 int* rStat = new int[43];
5204 for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
5205 std::vector<MdcRec_wirhit*> pt=TrasanTRK1.hitcol;
5206 int hit_in(0);
5207 if(debug_ == 4) cout<<"*********Pt size****"<< pt.size()<<endl;
5208 // Number of hits/layer
5209 int Num[43] = {0};
5210 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
5211 ii != pt.begin()-1; ii--) {
5212 Num[(*ii)->geo->Lyr()->Id()]++;
5213 }
5214
5215 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
5216 ii != pt.begin()-1; ii--) {
5217
5218 hit_asso++;
5219 if (Num[(*ii)->geo->Lyr()->Id()]>3) {
5220 if (debug_ >0)
5221 cout << "WARNING: I found " << Num[(*ii)->geo->Lyr()->Id()]
5222 << " hits in the layer "
5223 << (*ii)->geo->Lyr()->Id() << std::endl;
5224 continue;
5225 }
5226
5227 hit_in++;
5228 MdcRec_wirhit & rechit = **ii;
5229 double dist[2] = {rechit.ddl, rechit.ddr};
5230 double erdist[2] = {rechit.erddl, rechit.erddr};
5231 const MdcGeoWire* geo = rechit.geo;
5232
5233 int lr_decision(0);
5234 if (KalFitTrack::LR_ == 1){
5235 if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
5236 // if (rechit.lr==0) lr_decision=-1;
5237 else if (rechit.lr==1) lr_decision=1;
5238 }
5239
5240 int ind(geo->Lyr()->Id());
5241 track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
5242 lr_decision, rechit.tdc,
5243 dist, erdist,
5244 _wire+(geo->Id()), rechit.rechitptr));
5245 // inner/outer layer :
5246 rStat[ind]++;
5247 if (inlyr>ind) inlyr = ind;
5248 if (outlyr<ind) outlyr = ind;
5249 }
5250 // Empty layers :
5251 int empty_between(0), empty(0);
5252 for (int i= inlyr; i <= outlyr; i++)
5253 if (!rStat[i]) empty_between++;
5254 empty = empty_between+inlyr+(42-outlyr);
5255 delete [] rStat;
5256 }
5257 if (debug_ == 4)
5258 cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
5259
5260
5261 // RMK high momentum track under study, probably not neeeded...
5262 track_lead.order_wirhit(0);
5263 track_lead.type(type);
5264 unsigned int nhit = track_lead.HitsMdc().size();
5265 if (nhit<70) {
5266 cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
5267 return;
5268 }
5269
5270 // Initialisation :
5271 double KalFitst(0), KalFitax(0), KalFitschi2(0);
5272 // Move to the outer most hit :
5273 Hep3Vector outer_pivot(track_lead.x(fiTerm));
5274
5275 if(debug_ == 4) {
5276 std::cout<<"before track_lead.pivot(outer_pivot) ,the error matrix of track_lead is .."<<track_lead.Ea()<<std::endl;
5277 }
5278 track_lead.pivot(outer_pivot); // hi gay, the error matrix is changed in this function!!
5279 track_lead.bFieldZ(KalFitTrack::Bznom_);
5280 // attention best_chi2 reinitialize !!!
5281 if (nhit>=3 && !KalFitTrack::LR_)
5282 start_seed(track_lead, lead_, way, TrasanTRK);
5283 HepSymMatrix Eakal(5,0);
5284
5285 //init_matrix(TrasanTRK, Eakal);
5286
5287 double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
5288 if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
5289 choice_ = 6;
5290 }
5291
5292 init_matrix(choice_,TrasanTRK, Eakal);
5293
5294 //std::cout<<" Eakal be here: "<<Eakal<<std::endl;
5295
5296 if (debug_ == 4){
5297 std::cout << "from Mdc Pattern Recognition: " << std::endl;
5298 //HepPoint3D IP(0,0,0);
5299 Helix work(track_lead.pivot(),
5300 track_lead.a(),
5301 track_lead.Ea());
5302 work.pivot(IP);
5303 std::cout << " dr = " << work.a()[0]
5304 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
5305 std::cout << " phi0 = " << work.a()[1]
5306 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
5307 std::cout << " PT = " << 1/work.a()[2]
5308 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
5309 std::cout << " dz = " << work.a()[3]
5310 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
5311 std::cout << " tanl = " << work.a()[4]
5312 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
5313 }
5314 filter_fwd_calib(track_lead, lead_, way, Eakal);
5315 track_lead.update_forMdc();
5316
5317 //HepPoint3D IP(0,0,0);
5318 if (debug_ == 4) {
5319 cout << " Mdc FIRST KALMAN FIT " << std::endl;
5320 Helix work1(track_lead.pivot(),
5321 track_lead.a(),
5322 track_lead.Ea());
5323 work1.pivot(IP);
5324 cout << " dr = " << work1.a()[0]
5325 << ", Er_dr = " << sqrt(work1.Ea()[0][0]) << std::endl;
5326 cout << " phi0 = " << work1.a()[1]
5327 << ", Er_phi0 = " << sqrt(work1.Ea()[1][1]) << std::endl;
5328 cout << " PT = " << 1/work1.a()[2]
5329 << ", Er_kappa = " << sqrt(work1.Ea()[2][2]) << std::endl;
5330 cout << " dz = " << work1.a()[3]
5331 << ", Er_dz = " << sqrt(work1.Ea()[3][3]) << std::endl;
5332 cout << " tanl = " << work1.a()[4]
5333 << ", Er_tanl = " << sqrt(work1.Ea()[4][4]) << std::endl;
5334 }
5335
5336 // fill TDS
5337 RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
5338
5339 // Complete the track (other mass assumption, backward) and
5340 complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol);
5341 // }
5342
5343
5344 StatusCode kalsc;
5345 //check whether the RecMdcKalTrackCol has been already registered
5346 DataObject *aRecKalEvent;
5347 eventSvc()->findObject("/Event/Recon/RecMdcKalTrackCol", aRecKalEvent);
5348 if(aRecKalEvent!=NULL) {
5349 //then unregister RecMdcKalCol
5350 kalsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
5351 if(kalsc != StatusCode::SUCCESS) {
5352 log << MSG::FATAL << "Could not unregister RecMdcKalTrack collection" << endreq;
5353 return;
5354 }
5355 }
5356
5357 kalsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
5358 if( kalsc.isFailure()) {
5359 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
5360 return;
5361 }
5362 log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
5363
5364
5365
5366 StatusCode segsc;
5367 //check whether the RecMdcKalHelixSegCol has been already registered
5368 DataObject *aRecKalSegEvent;
5369 eventSvc()->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
5370 if(aRecKalSegEvent!=NULL) {
5371 //then unregister RecMdcKalHelixSegCol
5372 segsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
5373 if(segsc != StatusCode::SUCCESS) {
5374 log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
5375 return;
5376 }
5377 }
5378
5379 segsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
5380 if( segsc.isFailure() ) {
5381 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
5382 return;
5383 }
5384 log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
5385
5386
5387 double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
5388 double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0.),tanl2(0.);
5389 //check the result:RecMdcKalTrackCol
5390
5391 SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
5392 if (!kaltrkCol) {
5393 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
5394 return;
5395 }
5396 log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq;
5397 RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
5398 for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
5399 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
5400 << "Track Id: " << (*iter_trk)->getTrackId()
5401 << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
5402 << " Length of the track: "<< (*iter_trk)->getLength(2)
5403 << " Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
5404 << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
5405 <<" "<< (*iter_trk)->getChisq(1,2) << endreq
5406 << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,1)
5407 <<" "<< (*iter_trk)->getNdf(1,2) << endreq
5408 << "Kappa " << (*iter_trk)->getZHelix()[2]
5409 << "zhelixmu "<<(*iter_trk)->getZHelixMu()
5410 << endreq;
5411
5412 HelixSegRefVec gothelixsegs = (*iter_trk)->getVecHelixSegs();
5413 if(debug_ == 4) {
5414 std::cout<<"the size of gothelixsegs ..."<<gothelixsegs.size()<<std::endl;
5415 }
5416
5417 HelixSegRefVec::iterator it_gothelixseg = gothelixsegs.begin();
5418 for( ; it_gothelixseg != gothelixsegs.end(); it_gothelixseg++) {
5419 if(debug_ == 4) {
5420 std::cout<<"the layerId of this helixseg is ..."<<(*it_gothelixseg)->getLayerId()<<std::endl;
5421 std::cout<<"the residual of this helixseg exclude the meas hit"<<(*it_gothelixseg)->getResExcl()<<std::endl;
5422 std::cout<<"the residual of this helixseg include the meas hit"<<(*it_gothelixseg)->getResIncl()<<std::endl;
5423 std::cout<<"the track id of the helixseg is ..."<<(*it_gothelixseg)->getTrackId() <<std::endl;
5424 std::cout<<"the tof of the helixseg is ..."<<(*it_gothelixseg)->getTof()<<std::endl;
5425 std::cout<<"the Zhit of the helixseg is ..."<<(*it_gothelixseg)->getZhit()<<std::endl;
5426 }
5427 }
5428 for( int i = 0; i<43; i++) {
5429 log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
5430 << (*iter_trk)->getPathl(i) <<endreq;
5431 }
5432
5433 if(ntuple_&1) {
5434 m_trackid = (*iter_trk)->getTrackId();
5435 for( int jj =0, iii=0; jj<5; jj++) {
5436 m_length[jj] = (*iter_trk)->getLength(jj);
5437 m_tof[jj] = (*iter_trk)->getTof(jj);
5438 m_nhits[jj] = (*iter_trk)->getNhits(jj);
5439 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
5440 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
5441 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
5442 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
5443 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
5444 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
5445 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
5446 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
5447 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
5448 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
5449 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
5450 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
5451 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
5452 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
5453 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
5454 if(ntuple_&32) {
5455 for(int kk=0; kk<=jj; kk++,iii++) {
5456 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
5457 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
5458 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
5459 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
5460 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
5461 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
5462 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
5463 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
5464 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
5465 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
5466 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
5467 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
5468 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
5469 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
5470 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
5471 }
5472
5473 }
5474 }
5475
5476 // RootConversion changed in BOSS6.0, so use thefollowing:
5477 m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
5478 m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
5479 m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
5480 m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
5481 m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
5482 m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
5483 m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
5484 m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
5485 m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
5486 m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
5487
5488 m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
5489 m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
5490 m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
5491 m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
5492 m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
5493 m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
5494 m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
5495 m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
5496 m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
5497 m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
5498
5499 m_stat[0][0] = (*iter_trk)->getStat(0,0);
5500 m_stat[1][0] = (*iter_trk)->getStat(0,1);
5501 m_stat[2][0] = (*iter_trk)->getStat(0,2);
5502 m_stat[3][0] = (*iter_trk)->getStat(0,3);
5503 m_stat[4][0] = (*iter_trk)->getStat(0,4);
5504 m_stat[0][1] = (*iter_trk)->getStat(1,0);
5505 m_stat[1][1] = (*iter_trk)->getStat(1,1);
5506 m_stat[2][1] = (*iter_trk)->getStat(1,2);
5507 m_stat[3][1] = (*iter_trk)->getStat(1,3);
5508 m_stat[4][1] = (*iter_trk)->getStat(1,4);
5509
5510 m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
5511 m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
5512 m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
5513 m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
5514 m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
5515
5516 m_zpt = 1/m_zhelix[2];
5517 m_zpte = 1/m_zhelixe[2];
5518 m_zptmu = 1/m_zhelixmu[2];
5519 m_zptk = 1/m_zhelixk[2];
5520 m_zptp = 1/m_zhelixp[2];
5521
5522 m_fpt = 1/m_fhelix[2];
5523 m_fpte = 1/m_fhelixe[2];
5524 m_fptmu = 1/m_fhelixmu[2];
5525 m_fptk = 1/m_fhelixk[2];
5526 m_fptp = 1/m_fhelixp[2];
5527
5528 m_lpt = 1/m_lhelix[2];
5529 m_lpte = 1/m_lhelixe[2];
5530 m_lptmu = 1/m_lhelixmu[2];
5531 m_lptk = 1/m_lhelixk[2];
5532 m_lptp = 1/m_lhelixp[2];
5533
5534 m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
5535 m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
5536 m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
5537 m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
5538 m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
5539
5540 m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
5541 m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
5542 m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
5543 m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
5544 m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
5545 if(ntuple_&32) {
5546 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
5547 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
5548 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
5549 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
5550 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
5551 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
5552 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
5553 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
5554 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
5555 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
5556 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
5557 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
5558 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
5559 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
5560 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
5561 }
5562
5563 StatusCode sc1 = m_nt1->write();
5564 if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;
5565 }
5566
5567 if(ntuple_&4) {
5568 if(jj == 1) {
5569 phi1 = (*iter_trk)->getFFi0();
5570 r1 = (*iter_trk)->getFDr();
5571 z1 = (*iter_trk)->getFDz();
5572 kap1 = (*iter_trk)->getFCpa();
5573 tanl1 = (*iter_trk)->getFTanl();
5574 x1 = r1*cos(phi1);
5575 y1 = r1*sin(phi1);
5576 p1 = sqrt(1+tanl1*tanl1)/kap1;
5577 the1 = M_PI/2-atan(tanl1);
5578 } else if(jj == 2) {
5579 phi2 = (*iter_trk)->getFFi0();
5580 r2 = (*iter_trk)->getFDr();
5581 z2 = (*iter_trk)->getFDz();
5582 kap2 = (*iter_trk)->getFCpa();
5583 tanl2 = (*iter_trk)->getFTanl();
5584 x2 = r1*cos(phi2);
5585 y2 = r1*sin(phi2);
5586 p2 = sqrt(1+tanl2*tanl2)/kap1;
5587 the2 = M_PI/2-atan(tanl2);
5588 }
5589 }
5590 }
5591 if(ntuple_&4) {
5592 m_delx = x1 - x2;
5593 m_dely = y1 - y2;
5594 m_delz = z1 - z2;
5595 m_delthe = the1 + the2;
5596 m_delphi = phi1- phi2;
5597 m_delp = p1 - p2;
5598 StatusCode sc2 = m_nt2->write();
5599 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;
5600 }
5601 delete [] order;
5602 delete [] rCont;
5603 delete [] rGen;
5604 delete [] rOM;
5605
5606 if (debug_ == 4)
5607 cout << "Kalfitting finished " << std::endl;
5608}

Referenced by execute().

◆ kalman_fitting_csmalign() [2/2]

void KalFitAlg::kalman_fitting_csmalign ( void  )

◆ kalman_fitting_MdcxReco_Csmc_Sew() [1/2]

void KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew ( void  )

Definition at line 4561 of file KalFitAlg.cxx.

4562{
4563
4564 MsgStream log(msgSvc(), name());
4565 double Pt_threshold(0.3);
4566 Hep3Vector IP(0,0,0);
4567
4568 vector<MdcRec_trk>* mdcMgr = MdcRecTrkCol::getMdcRecTrkCol();
4569 vector<MdcRec_trk_add>* mdc_addMgr = MdcRecTrkAddCol::getMdcRecTrkAddCol();
4570 vector<MdcRec_wirhit>* whMgr = MdcRecWirhitCol::getMdcRecWirhitCol();
4571
4572 // Table Manager
4573 if ( !&whMgr ) return;
4574
4575 // Get reduced chi**2 of Mdc track :
4576 int ntrk = mdcMgr->size();
4577 // cout<<"ntrk: "<<ntrk<<endl;
4578
4579 int nhits = whMgr->size();
4580 //cout<<"nhits: "<<nhits<<endl;
4581
4582
4583 //check whether Recon already registered
4584 DataObject *aReconEvent;
4585 eventSvc()->findObject("/Event/Recon",aReconEvent);
4586 if(!aReconEvent) {
4587 // register ReconEvent Data Object to TDS;
4588 ReconEvent* recevt = new ReconEvent;
4589 StatusCode sc = eventSvc()->registerObject("/Event/Recon",recevt );
4590 if(sc!=StatusCode::SUCCESS) {
4591 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
4592 return;
4593 }
4594 }
4595
4596 RecMdcKalTrackCol* kalcol = new RecMdcKalTrackCol;
4598 //make RecMdcKalTrackCol
4599 log << MSG::INFO << "beginning to make RecMdcKalTrackCol" <<endreq;
4600
4601
4602 MdcRec_trk& TrasanTRK = *(mdcMgr->begin());
4603 MdcRec_trk_add& TrasanTRK_add = *(mdc_addMgr->begin());
4604 // Reject the ones with quality != 0
4605 // int trasqual = TrasanTRK_add.quality;
4606 // if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl;
4607 // if (trasqual) continue;
4608
4609 // What kind of KalFit ?
4610 int type(0);
4611 if ((TrasanTRK_add.decision & 32) == 32 ||
4612 (TrasanTRK_add.decision & 64) == 64) type = 1;
4613
4614 // Initialisation : (x, a, ea)
4615 HepPoint3D x(TrasanTRK.pivot[0],
4616 TrasanTRK.pivot[1],
4617 TrasanTRK.pivot[2]);
4618
4619 HepVector a(5);
4620 for(int i = 0; i < 5; i++)
4621 a[i] = TrasanTRK.helix[i];
4622
4623 HepSymMatrix ea(5);
4624 for(int i = 0, k = 0; i < 5; i++) {
4625 for(int j = 0; j <= i; j++) {
4626 ea[i][j] = matrixg_*TrasanTRK.error[k++];
4627 ea[j][i] = ea[i][j];
4628 }
4629 }
4630
4632
4633 double fiTerm = TrasanTRK.fiTerm;
4634 int way(1);
4635 // Prepare the track found :
4636 KalFitTrack track_lead = KalFitTrack(x, a, ea, lead_, 0, 0);
4637 track_lead.bFieldZ(KalFitTrack::Bznom_);
4638
4639 int hit_asso(0);
4640 // Reject the ones with quality != 0
4641 int trasqual = TrasanTRK_add.quality;
4642 if(debug_ == 4) cout<<"kalman_fitting>trasqual... "<<trasqual<<endl;
4643 if (trasqual) return;
4644 // Mdc Hits
4645 int inlyr(999), outlyr(-1);
4646 int* rStat = new int[43];
4647 for(int irStat=0;irStat<43;++irStat)rStat[irStat]=0;
4648 std::vector<MdcRec_wirhit*> pt=TrasanTRK.hitcol;
4649 int hit_in(0);
4650 if(debug_ == 4) cout<<"*********Pt size****"<< pt.size()<<endl;
4651 // Number of hits/layer
4652 int Num[43] = {0};
4653 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
4654 ii != pt.begin()-1; ii--) {
4655 Num[(*ii)->geo->Lyr()->Id()]++;
4656 }
4657
4658 for (vector<MdcRec_wirhit*>::iterator ii = pt.end()-1;
4659 ii != pt.begin()-1; ii--) {
4660
4661 hit_asso++;
4662 if (Num[(*ii)->geo->Lyr()->Id()]>3) {
4663 if (debug_ >0)
4664 cout << "WARNING: I found " << Num[(*ii)->geo->Lyr()->Id()]
4665 << " hits in the layer "
4666 << (*ii)->geo->Lyr()->Id() << std::endl;
4667 continue;
4668 }
4669
4670 hit_in++;
4671 MdcRec_wirhit & rechit = **ii;
4672 double dist[2] = {rechit.ddl, rechit.ddr};
4673 double erdist[2] = {rechit.erddl, rechit.erddr};
4674 const MdcGeoWire* geo = rechit.geo;
4675
4676 int lr_decision(0);
4677 if (KalFitTrack::LR_ == 1){
4678 if (rechit.lr==2 || rechit.lr==0) lr_decision=-1;
4679 // if (rechit.lr==0) lr_decision=-1;
4680 else if (rechit.lr==1) lr_decision=1;
4681 }
4682
4683 int ind(geo->Lyr()->Id());
4684 track_lead.appendHitsMdc( KalFitHitMdc(rechit.id,
4685 lr_decision, rechit.tdc,
4686 dist, erdist,
4687 _wire+(geo->Id()), rechit.rechitptr));
4688 // inner/outer layer :
4689 rStat[ind]++;
4690 if (inlyr>ind) inlyr = ind;
4691 if (outlyr<ind) outlyr = ind;
4692 }
4693 // Empty layers :
4694 int empty_between(0), empty(0);
4695 for (int i= inlyr; i <= outlyr; i++)
4696 if (!rStat[i]) empty_between++;
4697 empty = empty_between+inlyr+(42-outlyr);
4698 delete [] rStat;
4699
4700 if (debug_ == 4)
4701 cout << "**** NUMBER OF Mdc HITS (TRASAN) = " << hit_asso << std::endl;
4702
4703
4704 // RMK high momentum track under study, probably not neeeded...
4705 track_lead.order_wirhit(0);
4706 track_lead.type(type);
4707 unsigned int nhit = track_lead.HitsMdc().size();
4708 if (nhit<70) {
4709 cout << " ATTENTION TRACK WITH ONLY HITS " << nhit << std::endl;
4710 return;
4711 }
4712
4713 // Initialisation :
4714 double KalFitst(0), KalFitax(0), KalFitschi2(0);
4715 // Move to the outer most hit :
4716 Hep3Vector outer_pivot(track_lead.x(fiTerm));
4717
4718 if(debug_ == 4) {
4719 std::cout<<"before track_lead.pivot(outer_pivot) ,the error matrix of track_lead is .."<<track_lead.Ea()<<std::endl;
4720 }
4721 track_lead.pivot(outer_pivot); // hi gay, the error matrix is changed in this function!!
4722 track_lead.bFieldZ(KalFitTrack::Bznom_);
4723 // attention best_chi2 reinitialize !!!
4724 if (nhit>=3 && !KalFitTrack::LR_)
4725 start_seed(track_lead, lead_, way, TrasanTRK);
4726 HepSymMatrix Eakal(5,0);
4727
4728 //init_matrix(TrasanTRK, Eakal);
4729
4730 double costheta = track_lead.a()[4] / sqrt(1.0 + track_lead.a()[4]*track_lead.a()[4]);
4731 if( (1.0/fabs(track_lead.a()[2]) < pt_cut_ ) && (fabs(costheta)> theta_cut_) ) {
4732 choice_ = 6;
4733 }
4734
4735 init_matrix(choice_,TrasanTRK, Eakal);
4736
4737 //std::cout<<" Eakal be here: "<<Eakal<<std::endl;
4738
4739 if (debug_ == 4){
4740 std::cout << "from Mdc Pattern Recognition: " << std::endl;
4741 //HepPoint3D IP(0,0,0);
4742 Helix work(track_lead.pivot(),
4743 track_lead.a(),
4744 track_lead.Ea());
4745 work.pivot(IP);
4746 std::cout << " dr = " << work.a()[0]
4747 << ", Er_dr = " << sqrt(work.Ea()[0][0]) << std::endl;
4748 std::cout << " phi0 = " << work.a()[1]
4749 << ", Er_phi0 = " << sqrt(work.Ea()[1][1]) << std::endl;
4750 std::cout << " PT = " << 1/work.a()[2]
4751 << ", Er_kappa = " << sqrt(work.Ea()[2][2]) << std::endl;
4752 std::cout << " dz = " << work.a()[3]
4753 << ", Er_dz = " << sqrt(work.Ea()[3][3]) << std::endl;
4754 std::cout << " tanl = " << work.a()[4]
4755 << ", Er_tanl = " << sqrt(work.Ea()[4][4]) << std::endl;
4756 }
4757 filter_fwd_calib(track_lead, lead_, way, Eakal);
4758 track_lead.update_forMdc();
4759
4760 //HepPoint3D IP(0,0,0);
4761 if (debug_ == 4) {
4762 cout << " Mdc FIRST KALMAN FIT " << std::endl;
4763 Helix work1(track_lead.pivot(),
4764 track_lead.a(),
4765 track_lead.Ea());
4766 work1.pivot(IP);
4767 cout << " dr = " << work1.a()[0]
4768 << ", Er_dr = " << sqrt(work1.Ea()[0][0]) << std::endl;
4769 cout << " phi0 = " << work1.a()[1]
4770 << ", Er_phi0 = " << sqrt(work1.Ea()[1][1]) << std::endl;
4771 cout << " PT = " << 1/work1.a()[2]
4772 << ", Er_kappa = " << sqrt(work1.Ea()[2][2]) << std::endl;
4773 cout << " dz = " << work1.a()[3]
4774 << ", Er_dz = " << sqrt(work1.Ea()[3][3]) << std::endl;
4775 cout << " tanl = " << work1.a()[4]
4776 << ", Er_tanl = " << sqrt(work1.Ea()[4][4]) << std::endl;
4777 }
4778
4779 // fill TDS
4780 RecMdcKalTrack* kaltrk = new RecMdcKalTrack;
4781
4782 // Complete the track (other mass assumption, backward) and
4783 complete_track(TrasanTRK, TrasanTRK_add, track_lead, kaltrk,kalcol,segcol);
4784
4785
4786 StatusCode kalsc;
4787 //check whether the RecMdcKalTrackCol has been already registered
4788 DataObject *aRecKalEvent;
4789 eventSvc()->findObject("/Event/Recon/RecMdcKalTrackCol", aRecKalEvent);
4790 if(aRecKalEvent!=NULL) {
4791 //then unregister RecMdcKalCol
4792 kalsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalTrackCol");
4793 if(kalsc != StatusCode::SUCCESS) {
4794 log << MSG::FATAL << "Could not unregister RecMdcKalTrack collection" << endreq;
4795 return;
4796 }
4797 }
4798
4799 kalsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalTrackCol", kalcol);
4800 if( kalsc.isFailure()) {
4801 log << MSG::FATAL << "Could not register RecMdcKalTrack" << endreq;
4802 return;
4803 }
4804 log << MSG::INFO << "RecMdcKalTrackCol registered successfully!" <<endreq;
4805
4806
4807
4808 StatusCode segsc;
4809 //check whether the RecMdcKalHelixSegCol has been already registered
4810 DataObject *aRecKalSegEvent;
4811 eventSvc()->findObject("/Event/Recon/RecMdcKalHelixSegCol", aRecKalSegEvent);
4812 if(aRecKalSegEvent!=NULL) {
4813 //then unregister RecMdcKalHelixSegCol
4814 segsc = eventSvc()->unregisterObject("/Event/Recon/RecMdcKalHelixSegCol");
4815 if(segsc != StatusCode::SUCCESS) {
4816 log << MSG::FATAL << "Could not unregister RecMdcKalHelixSegCol collection" << endreq;
4817 return;
4818 }
4819 }
4820
4821 segsc = eventSvc()->registerObject("/Event/Recon/RecMdcKalHelixSegCol", segcol);
4822 if( segsc.isFailure() ) {
4823 log << MSG::FATAL << "Could not register RecMdcKalHelixSeg" << endreq;
4824 return;
4825 }
4826 log << MSG::INFO << "RecMdcKalHelixSegCol registered successfully!" <<endreq;
4827
4828
4829 double x1(0.),x2(0.),y1(0.),y2(0.),z1(0.),z2(0.),the1(0.),the2(0.),phi1(0.),phi2(0.),p1(0.),p2(0.);
4830 double r1(0.),r2(0.),kap1(999.),kap2(999.),tanl1(0.),tanl2(0.);
4831 //check the result:RecMdcKalTrackCol
4832
4833 SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
4834 if (!kaltrkCol) {
4835 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
4836 return;
4837 }
4838 log << MSG::INFO << "Begin to check RecMdcKalTrackCol"<<endreq;
4839 RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
4840 for( int jj=1; iter_trk != kaltrkCol->end(); iter_trk++,jj++) {
4841 log << MSG::DEBUG << "retrieved MDC Kalmantrack:"
4842 << "Track Id: " << (*iter_trk)->getTrackId()
4843 << " Mass of the fit: "<< (*iter_trk)->getMass(2)<< endreq
4844 << " Length of the track: "<< (*iter_trk)->getLength(2)
4845 << " Tof of the track: "<< (*iter_trk)->getTof(2) << endreq
4846 << " Chisq of the fit: "<< (*iter_trk)->getChisq(0,2)
4847 <<" "<< (*iter_trk)->getChisq(1,2) << endreq
4848 << "Ndf of the fit: "<< (*iter_trk)->getNdf(0,1)
4849 <<" "<< (*iter_trk)->getNdf(1,2) << endreq
4850 << "Kappa " << (*iter_trk)->getZHelix()[2]
4851 << "zhelixmu "<<(*iter_trk)->getZHelixMu()
4852 << endreq;
4853
4854 HelixSegRefVec gothelixsegs = (*iter_trk)->getVecHelixSegs();
4855 if(debug_ == 4) {
4856 std::cout<<"the size of gothelixsegs ..."<<gothelixsegs.size()<<std::endl;
4857 }
4858
4859 HelixSegRefVec::iterator it_gothelixseg = gothelixsegs.begin();
4860 for( ; it_gothelixseg != gothelixsegs.end(); it_gothelixseg++) {
4861 if(debug_ == 4) {
4862 std::cout<<"the layerId of this helixseg is ..."<<(*it_gothelixseg)->getLayerId()<<std::endl;
4863 std::cout<<"the residual of this helixseg exclude the meas hit"<<(*it_gothelixseg)->getResExcl()<<std::endl;
4864 std::cout<<"the residual of this helixseg include the meas hit"<<(*it_gothelixseg)->getResIncl()<<std::endl;
4865 std::cout<<"the track id of the helixseg is ..."<<(*it_gothelixseg)->getTrackId() <<std::endl;
4866 std::cout<<"the tof of the helixseg is ..."<<(*it_gothelixseg)->getTof()<<std::endl;
4867 std::cout<<"the Zhit of the helixseg is ..."<<(*it_gothelixseg)->getZhit()<<std::endl;
4868 }
4869 }
4870 for( int i = 0; i<43; i++) {
4871 log << MSG::DEBUG << "retrieved pathl["<<i<<"]= "
4872 << (*iter_trk)->getPathl(i) <<endreq;
4873 }
4874
4875 if(ntuple_&1) {
4876 m_trackid = (*iter_trk)->getTrackId();
4877 for( int jj =0, iii=0; jj<5; jj++) {
4878 m_length[jj] = (*iter_trk)->getLength(jj);
4879 m_tof[jj] = (*iter_trk)->getTof(jj);
4880 m_nhits[jj] = (*iter_trk)->getNhits(jj);
4881 m_zhelix[jj] = (*iter_trk)->getZHelix()[jj];
4882 m_zhelixe[jj] = (*iter_trk)->getZHelixE()[jj];
4883 m_zhelixmu[jj] = (*iter_trk)->getZHelixMu()[jj];
4884 m_zhelixk[jj] = (*iter_trk)->getZHelixK()[jj];
4885 m_zhelixp[jj] = (*iter_trk)->getZHelixP()[jj];
4886 m_fhelix[jj] = (*iter_trk)->getFHelix()[jj];
4887 m_fhelixe[jj] = (*iter_trk)->getFHelixE()[jj];
4888 m_fhelixmu[jj] = (*iter_trk)->getFHelixMu()[jj];
4889 m_fhelixk[jj] = (*iter_trk)->getFHelixK()[jj];
4890 m_fhelixp[jj] = (*iter_trk)->getFHelixP()[jj];
4891 m_lhelix[jj] = (*iter_trk)->getLHelix()[jj];
4892 m_lhelixe[jj] = (*iter_trk)->getLHelixE()[jj];
4893 m_lhelixmu[jj] = (*iter_trk)->getLHelixMu()[jj];
4894 m_lhelixk[jj] = (*iter_trk)->getLHelixK()[jj];
4895 m_lhelixp[jj] = (*iter_trk)->getLHelixP()[jj];
4896 if(ntuple_&32) {
4897 for(int kk=0; kk<=jj; kk++,iii++) {
4898 m_zerror[iii] = (*iter_trk)->getZError()[jj][kk];
4899 m_zerrore[iii] = (*iter_trk)->getZErrorE()[jj][kk];
4900 m_zerrormu[iii] = (*iter_trk)->getZErrorMu()[jj][kk];
4901 m_zerrork[iii] = (*iter_trk)->getZErrorK()[jj][kk];
4902 m_zerrorp[iii] = (*iter_trk)->getZErrorP()[jj][kk];
4903 m_ferror[iii] = (*iter_trk)->getFError()[jj][kk];
4904 m_ferrore[iii] = (*iter_trk)->getFErrorE()[jj][kk];
4905 m_ferrormu[iii] = (*iter_trk)->getFErrorMu()[jj][kk];
4906 m_ferrork[iii] = (*iter_trk)->getFErrorK()[jj][kk];
4907 m_ferrorp[iii] = (*iter_trk)->getFErrorP()[jj][kk];
4908 m_lerror[iii] = (*iter_trk)->getLError()[jj][kk];
4909 m_lerrore[iii] = (*iter_trk)->getLErrorE()[jj][kk];
4910 m_lerrormu[iii] = (*iter_trk)->getLErrorMu()[jj][kk];
4911 m_lerrork[iii] = (*iter_trk)->getLErrorK()[jj][kk];
4912 m_lerrorp[iii] = (*iter_trk)->getLErrorP()[jj][kk];
4913 }
4914
4915 }
4916 }
4917
4918 // RootConversion changed in BOSS6.0, so use thefollowing:
4919 m_chisq[0][0] = (*iter_trk)->getChisq(0,0);
4920 m_chisq[1][0] = (*iter_trk)->getChisq(0,1);
4921 m_chisq[2][0] = (*iter_trk)->getChisq(0,2);
4922 m_chisq[3][0] = (*iter_trk)->getChisq(0,3);
4923 m_chisq[4][0] = (*iter_trk)->getChisq(0,4);
4924 m_chisq[0][1] = (*iter_trk)->getChisq(1,0);
4925 m_chisq[1][1] = (*iter_trk)->getChisq(1,1);
4926 m_chisq[2][1] = (*iter_trk)->getChisq(1,2);
4927 m_chisq[3][1] = (*iter_trk)->getChisq(1,3);
4928 m_chisq[4][1] = (*iter_trk)->getChisq(1,4);
4929
4930 m_ndf[0][0] = (*iter_trk)->getNdf(0,0);
4931 m_ndf[1][0] = (*iter_trk)->getNdf(0,1);
4932 m_ndf[2][0] = (*iter_trk)->getNdf(0,2);
4933 m_ndf[3][0] = (*iter_trk)->getNdf(0,3);
4934 m_ndf[4][0] = (*iter_trk)->getNdf(0,4);
4935 m_ndf[0][1] = (*iter_trk)->getNdf(1,0);
4936 m_ndf[1][1] = (*iter_trk)->getNdf(1,1);
4937 m_ndf[2][1] = (*iter_trk)->getNdf(1,2);
4938 m_ndf[3][1] = (*iter_trk)->getNdf(1,3);
4939 m_ndf[4][1] = (*iter_trk)->getNdf(1,4);
4940
4941 m_stat[0][0] = (*iter_trk)->getStat(0,0);
4942 m_stat[1][0] = (*iter_trk)->getStat(0,1);
4943 m_stat[2][0] = (*iter_trk)->getStat(0,2);
4944 m_stat[3][0] = (*iter_trk)->getStat(0,3);
4945 m_stat[4][0] = (*iter_trk)->getStat(0,4);
4946 m_stat[0][1] = (*iter_trk)->getStat(1,0);
4947 m_stat[1][1] = (*iter_trk)->getStat(1,1);
4948 m_stat[2][1] = (*iter_trk)->getStat(1,2);
4949 m_stat[3][1] = (*iter_trk)->getStat(1,3);
4950 m_stat[4][1] = (*iter_trk)->getStat(1,4);
4951
4952 m_fptot = sqrt(1+pow(m_fhelix[4],2))/m_fhelix[2];
4953 m_fptote = sqrt(1+pow(m_fhelixe[4],2))/m_fhelixe[2];
4954 m_fptotmu = sqrt(1+pow(m_fhelixmu[4],2))/m_fhelixmu[2];
4955 m_fptotk = sqrt(1+pow(m_fhelixk[4],2))/m_fhelixk[2];
4956 m_fptotp = sqrt(1+pow(m_fhelixp[4],2))/m_fhelixp[2];
4957
4958 m_zpt = 1/m_zhelix[2];
4959 m_zpte = 1/m_zhelixe[2];
4960 m_zptmu = 1/m_zhelixmu[2];
4961 m_zptk = 1/m_zhelixk[2];
4962 m_zptp = 1/m_zhelixp[2];
4963
4964 m_fpt = 1/m_fhelix[2];
4965 m_fpte = 1/m_fhelixe[2];
4966 m_fptmu = 1/m_fhelixmu[2];
4967 m_fptk = 1/m_fhelixk[2];
4968 m_fptp = 1/m_fhelixp[2];
4969
4970 m_lpt = 1/m_lhelix[2];
4971 m_lpte = 1/m_lhelixe[2];
4972 m_lptmu = 1/m_lhelixmu[2];
4973 m_lptk = 1/m_lhelixk[2];
4974 m_lptp = 1/m_lhelixp[2];
4975
4976 m_lptot = sqrt(1+pow(m_lhelix[4],2))/m_lhelix[2];
4977 m_lptote = sqrt(1+pow(m_lhelixe[4],2))/m_lhelixe[2];
4978 m_lptotmu = sqrt(1+pow(m_lhelixmu[4],2))/m_lhelixmu[2];
4979 m_lptotk = sqrt(1+pow(m_lhelixk[4],2))/m_lhelixk[2];
4980 m_lptotp = sqrt(1+pow(m_lhelixp[4],2))/m_lhelixp[2];
4981
4982 m_zptot = sqrt(1+pow(m_zhelix[4],2))/m_zhelix[2];
4983 m_zptote = sqrt(1+pow(m_zhelixe[4],2))/m_zhelixe[2];
4984 m_zptotmu = sqrt(1+pow(m_zhelixmu[4],2))/m_zhelixmu[2];
4985 m_zptotk = sqrt(1+pow(m_zhelixk[4],2))/m_zhelixk[2];
4986 m_zptotp = sqrt(1+pow(m_zhelixp[4],2))/m_zhelixp[2];
4987 if(ntuple_&32) {
4988 m_zsigp = sqrt(pow((m_zptot/m_zhelix[2]),2)*m_zerror[5]+
4989 pow((m_zhelix[4]/m_zptot),2)*pow((1/m_zhelix[2]),4)*m_zerror[14]-
4990 2*m_zhelix[4]*m_zerror[12]*pow((1/m_zhelix[2]),3));
4991 m_zsigpe = sqrt(pow((m_zptote/m_zhelixe[2]),2)*m_zerrore[5]+
4992 pow((m_zhelixe[4]/m_zptote),2)*pow((1/m_zhelixe[2]),4)*m_zerrore[14]-
4993 2*m_zhelixe[4]*m_zerrore[12]*pow((1/m_zhelixe[2]),3));
4994 m_zsigpmu = sqrt(pow((m_zptotmu/m_zhelixmu[2]),2)*m_zerrormu[5]+
4995 pow((m_zhelixmu[4]/m_zptotmu),2)*pow((1/m_zhelixmu[2]),4)*m_zerrormu[14]-
4996 2*m_zhelixmu[4]*m_zerrormu[12]*pow((1/m_zhelixmu[2]),3));
4997 m_zsigpk = sqrt(pow((m_zptotk/m_zhelixk[2]),2)*m_zerrork[5]+
4998 pow((m_zhelixk[4]/m_zptotk),2)*pow((1/m_zhelixk[2]),4)*m_zerrork[14]-
4999 2*m_zhelixk[4]*m_zerrork[12]*pow((1/m_zhelixk[2]),3));
5000 m_zsigpp = sqrt(pow((m_zptotp/m_zhelixp[2]),2)*m_zerrorp[5]+
5001 pow((m_zhelixp[4]/m_zptotp),2)*pow((1/m_zhelixp[2]),4)*m_zerrorp[14]-
5002 2*m_zhelixp[4]*m_zerrorp[12]*pow((1/m_zhelixp[2]),3));
5003 }
5004
5005 StatusCode sc1 = m_nt1->write();
5006 if( sc1.isFailure() ) cout<<"Ntuple1 filling failed!"<<endl;
5007 }
5008
5009 if(ntuple_&4) {
5010 if(jj == 1) {
5011 phi1 = (*iter_trk)->getFFi0();
5012 r1 = (*iter_trk)->getFDr();
5013 z1 = (*iter_trk)->getFDz();
5014 kap1 = (*iter_trk)->getFCpa();
5015 tanl1 = (*iter_trk)->getFTanl();
5016 x1 = r1*cos(phi1);
5017 y1 = r1*sin(phi1);
5018 p1 = sqrt(1+tanl1*tanl1)/kap1;
5019 the1 = M_PI/2-atan(tanl1);
5020 } else if(jj == 2) {
5021 phi2 = (*iter_trk)->getFFi0();
5022 r2 = (*iter_trk)->getFDr();
5023 z2 = (*iter_trk)->getFDz();
5024 kap2 = (*iter_trk)->getFCpa();
5025 tanl2 = (*iter_trk)->getFTanl();
5026 x2 = r1*cos(phi2);
5027 y2 = r1*sin(phi2);
5028 p2 = sqrt(1+tanl2*tanl2)/kap1;
5029 the2 = M_PI/2-atan(tanl2);
5030 }
5031 }
5032 }
5033 if(ntuple_&4) {
5034 m_delx = x1 - x2;
5035 m_dely = y1 - y2;
5036 m_delz = z1 - z2;
5037 m_delthe = the1 + the2;
5038 m_delphi = phi1- phi2;
5039 m_delp = p1 - p2;
5040 StatusCode sc2 = m_nt2->write();
5041 if( sc2.isFailure() ) cout<<"Ntuple2 filling failed!"<<endl;
5042 }
5043
5044 if (debug_ == 4)
5045 cout << "Kalfitting finished " << std::endl;
5046}

Referenced by execute().

◆ kalman_fitting_MdcxReco_Csmc_Sew() [2/2]

void KalFitAlg::kalman_fitting_MdcxReco_Csmc_Sew ( void  )

◆ makeGemHitsCol() [1/2]

void KalFitAlg::makeGemHitsCol ( )

Definition at line 6738 of file KalFitAlg.cxx.

6739{
6740 for(int i=0; i<3; i++) myGemHitCol[i].clear();
6741
6742 /*SmartDataPtr<Event::MdcMcHitCol> mdcMcHitCol(eventSvc(), "/Event/MC/MdcMcHitCol");
6743 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),"/Event/Digi/MdcDigiCol");
6744
6745 int nHits, nDigi;
6746 unsigned int stripIndx, isVStrip;
6747 int layer;
6748 double x, y, z, r, phi;
6749
6750 nHits = mdcMcHitCol->size();
6751 nDigi = mdcDigiCol->size();
6752
6753 //cout<<__FUNCTION__<<":: nHits = "<<nHits<<endl;
6754
6755 Rndm::Numbers gaussRPhi(randSvc(), Rndm::Gauss(0.,0.023));
6756 Rndm::Numbers gaussZ(randSvc(), Rndm::Gauss(0.,0.05));
6757
6758 MdcMcHitCol::const_iterator it = mdcMcHitCol->begin();
6759
6760 cout<<endl<<endl<<" ------------- Mdc MC hits: ------------"<<endl<<endl;*/
6761
6762 SmartDataPtr<RecCgemClusterCol> cgemClusterCol(eventSvc(),"/Event/Recon/RecCgemClusterCol");
6763 int layer,sheet;
6764 double phi,v;
6765 RecCgemClusterCol::const_iterator it = cgemClusterCol->begin();
6766 for(;it!=cgemClusterCol->end();it++){
6767 //cout<<"cluster:"<<(*it)->getclusterid()<<" phi:"<<(*it)->getrecphi()<<" z:"<<(*it)->getRecZ()<<endl;
6768 if((*it)->getflag()==2){
6769 layer = (*it)->getlayerid();
6770 sheet = (*it)->getsheetid();
6771 phi = (*it)->getrecphi();
6772 v = (*it)->getrecv();
6773 KalFitGemHit aKalFitGemHit(phi,v,layer,sheet);
6774 myGemHitCol[layer].push_back(aKalFitGemHit);
6775 }
6776 }
6777 if(debug_==4){
6778 cout << "Gem information" << endl;
6779 cout << "first layer " << myGemHitCol[0].size() << endl;
6780 cout << "second layer" << myGemHitCol[1].size() << endl;
6781 cout << "third layer" << myGemHitCol[2].size() << endl;
6782 }
6783 /*
6784 for(;it!=mdcMcHitCol->end(); it++)
6785 {
6786 Identifier id= (*it)->identify();
6787 layer = MdcID::layer(id);
6788 if(layer>7) continue;
6789 stripIndx = (*it)->getDriftDistance();
6790 isVStrip = (*it)->getPositionFlag();
6791 x = ((*it)->getPositionX())*0.1; // mm->cm
6792 y = ((*it)->getPositionY())*0.1; // mm->cm
6793 z = ((*it)->getPositionZ())*0.1; // mm->cm
6794 r=sqrt(x*x+y*y);
6795 phi=atan2(y,x);
6796 cout<<"id, layer , stripIndx, isVSTrip = "<<id<<", "<<layer<<", "<<stripIndx<<", "<<isVStrip<<endl;
6797 //cout<<" true x, y, z, phi, r = "<<x<<", "<<y<<", "<<z<<", "<<phi<<", "<<r<<endl;
6798 if(myGemHitCol[layer].empty())
6799 {
6800 //cout<<"myGemHitCol["<<layer<<"] is empty"<<endl;
6801 phi+=gaussRPhi()/r;
6802 while(phi>M_PI) phi-=M_PI2;
6803 while(phi<-M_PI) phi+=M_PI2;
6804 z+=gaussZ();
6805 KalFitGemHit aKalFitGemHit(phi,z,r);
6806 //cout<<" resam x, y, z, phi, r = "<<x<<", "<<y<<", "<<z<<", "<<phi<<", "<<r<<endl;
6807 myGemHitCol[layer].push_back(aKalFitGemHit);
6808 }
6809 }
6810
6811 cout<<endl<<endl<<" ------------- Mdc digi: ------------"<<endl<<endl;
6812
6813 MdcDigiCol::const_iterator it_digi = mdcDigiCol->begin();
6814 for(;it_digi!=mdcDigiCol->end(); it_digi++)
6815 {
6816 Identifier id = (*it_digi)->identify();
6817 layer = MdcID::layer(id);
6818 if(layer>7) continue;
6819 double stripId = RawDataUtil::MdcTime((*it_digi)->getTimeChannel());
6820 double isV = RawDataUtil::MdcCharge((*it_digi)->getChargeChannel());
6821 cout<<"id, layer , stripIndx, isVSTrip = "<<id<<", "<<layer<<", "<<stripId<<", "<<isV<<endl;
6822 stripIndx=stripId+0.5;
6823 cout<<" stripIndx = "<<id<<", "<<layer<<", "<<stripIndx<<", "<<isV<<endl;
6824 }
6825 */
6826
6827 // --- print out GEM hits
6828 bool prtGemHits=false;
6829 //bool prtGemHits=true;
6830 if(prtGemHits) cout<<endl<<"------- GEM hits: --------"<<endl;
6831 for(int i=0; i<3; i++)
6832 {
6833 if(prtGemHits) cout<<"### layer "<<i<<endl;
6834 //int nhits = myGemHitCol[i].size();
6835 KalFitGemHitCol::const_iterator it_GemHit = (myGemHitCol[i]).begin();
6836 for(int j=0; it_GemHit!=(myGemHitCol[i]).end(); it_GemHit++, j++)
6837 {
6838 if(prtGemHits) cout<<" hit "<<(j+1)<<": phi, z, r = "<<it_GemHit->getPhi()<<", "<<it_GemHit->getZ()<<", "<<it_GemHit->getR()<<endl;
6839 }
6840 }
6841
6842}
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35

Referenced by execute().

◆ makeGemHitsCol() [2/2]

void KalFitAlg::makeGemHitsCol ( )

◆ residual() [1/2]

void KalFitAlg::residual ( KalFitTrack track)

Definition at line 7462 of file KalFitAlg.cxx.

7463{
7464
7465 //cout<<"R:"<<track.pivot().perp()<<endl;
7466 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
7467 if (!eventHeader) {
7468 cout << "Could not find Event Header" << endl;
7469 }
7470 int eventNo = eventHeader->eventNumber();
7471 int runNo = eventHeader->runNumber();
7472 m_evt=eventNo;
7473 //cout<<"Event::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<<eventNo<<endl;
7474
7475 SmartDataPtr<McParticleCol> mcPartCol(eventSvc(),"/Event/MC/McParticleCol");
7476 if (!mcPartCol) {
7477 cout << "Could not find McParticle" << endl;
7478 }
7479
7480 HepVector mc_a(5,0);
7481 McParticleCol::iterator i_mcTrk = mcPartCol->begin();
7482 for (;i_mcTrk != mcPartCol->end(); i_mcTrk++) {
7483 if(!(*i_mcTrk)->primaryParticle()) continue;
7484 const HepLorentzVector& mom((*i_mcTrk)->initialFourMomentum());
7485 const HepLorentzVector& pos = (*i_mcTrk)->initialPosition();
7486 //cout<<"MCposition:"<<pos.x()<<" "<<pos.y()<<" "<<pos.z()<<" "<<endl;
7487 double charge = 0.0;
7488 int pid = (*i_mcTrk)->particleProperty();
7489 if( pid >0 ) {
7490 charge = m_particleTable->particle( pid )->charge();
7491 } else if ( pid <0 ) {
7492 charge = m_particleTable->particle( -pid )->charge();
7493 charge *= -1;
7494 } else {
7495 }
7496 HepPoint3D pos2(pos.x(),pos.y(),pos.z());
7497 Hep3Vector mom2(mom.px(),mom.py(),mom.pz());
7498
7499 Helix mchelix(pos2, mom2, charge);
7500 //if( debug_ == 0) cout<< "helix: "<<mchelix.a()<<endl;
7501 mchelix.pivot( HepPoint3D(0,0,0) );
7502 for( int j =0; j<5; j++) {
7503 //m_mchelix[j] = mchelix.a()[j];
7504 mc_a[j] = mchelix.a()[j];
7505 }
7506 //m_mcpid = pid;
7507 //m_mcptot = sqrt(1+pow(m_mchelix[4],2))/m_mchelix[2];
7508 }
7509 HepPoint3D IP(0,0,0);
7510 Helix MChelix(IP,mc_a);
7511 MChelix.pivot(track.pivot());
7512 m_diff_dr = track.a()[0]-MChelix.a()[0];
7513 m_diff_phi0 = track.a()[1]-MChelix.a()[1];
7514 m_diff_kappa = track.a()[2]-MChelix.a()[2];
7515 m_diff_dz = track.a()[3]-MChelix.a()[3];
7516 m_diff_tanl = track.a()[4]-MChelix.a()[4];
7517 if(track.a()[2] != 0 && MChelix.a()[2] != 0)
7518 m_diff_p = sqrt(1+track.a()[4]*track.a()[4])/track.a()[2] - sqrt(1+MChelix.a()[4]*MChelix.a()[4])/MChelix.a()[2];
7519 else
7520 m_diff_p =9999;
7521 StatusCode sc12 = m_nt12->write();
7522 if( sc12.isFailure() ) cout<<"Ntuple12 filling failed!"<<endl;
7523 //cout<<"kalfit a:"<<track.a()<<endl<<"MCtruth a:"<<MChelix.a()<<endl<<endl;
7524///*
7525 // --- calculate the material quantity
7526 bool printwalls = false;
7527 if(printwalls){
7528 double material_quantity(0);
7529 int size = _BesKalmanFitWalls.size();
7530 for(int i=0;i<size;i++)
7531 {
7532 double ro = _BesKalmanFitWalls[i].radius();
7533 double ri = _BesKalmanFitWalls[i].rmin();
7534 double thick = ro-ri;
7535 KalFitMaterial material = _BesKalmanFitWalls[i].material();
7536 double X0 = material.X0();
7537 double rho = material.get_density();
7538 double Z = material.Z();
7539 //double X = X0/rho;
7540 material_quantity += 100*thick/X0;
7541 cout<<"----------------------------------------------------------------------------------------------------"<<endl;
7542 cout<<"wall"<<i+1<<" Z:"<<setw(12)<<Z<<endl;
7543 cout<<"Ri(cm):"<<setw(12)<<ri<<"Ro(cm):"<<setw(12)<<ro<<"T(cm):"<<setw(12)<<thick<<"X0(cm):"<<setw(12)<<X0<<"T/X0(%)="<<setw(12)<<100*thick/X0<<"accumulation(%):"<<setw(12)<<material_quantity<<endl;
7544 cout<<"----------------------------------------------------------------------------------------------------"<<endl;
7545 cout<<endl;
7546 //cout<<"wall"<<i+1<<" Z:"<<Z<<" Thick:"<<thick<<" Density:"<<rho <<" X0:"<<X0<<endl;
7547 //cout<<"radiation length="<<x<<" material quantity="<<thick/x<<endl;
7548
7549 }
7550 cout<<"============================================================"<<endl;
7551 cout<<"total material quantity="<<material_quantity<<endl;
7552 cout<<"============================================================"<<endl;
7553 }
7554//*/
7555}
#define X0

Referenced by complete_track().

◆ residual() [2/2]

void KalFitAlg::residual ( KalFitTrack track)

◆ sameas() [1/2]

void KalFitAlg::sameas ( RecMdcKalTrack trk,
int  l_mass,
int  imain 
)

complete the RecMdcKalTrackCol

Definition at line 2431 of file KalFitAlg.cxx.

2432{
2433 // note: for this function,only imain==lead(2) considered
2434 //std::cout<<"BEGINNING THE sameas() function ..."<<std::endl;
2435 trk->setMass(trk->getMass(imain), l_mass);
2436 trk->setLength(trk->getLength(imain), l_mass);
2437 trk->setTof(trk->getTof(imain), l_mass);
2438 trk->setNhits(trk->getNhits(imain), l_mass);
2439
2440 for(int jj = 0; jj<2; jj++) {
2441 trk->setStat(trk->getStat(jj,imain), jj, l_mass);
2442 trk->setChisq(trk->getChisq(jj, l_mass), jj, l_mass);
2443 trk->setNdf(trk->getChisq(jj, l_mass), jj, l_mass);
2444 }
2445 trk->setLHelix(trk->getFHelix(),l_mass);
2446 trk->setLError(trk->getFError(),l_mass);
2447}

Referenced by complete_track().

◆ sameas() [2/2]

void KalFitAlg::sameas ( RecMdcKalTrack trk,
int  l_mass,
int  imain 
)

complete the RecMdcKalTrackCol

◆ set_Mdc() [1/2]

void KalFitAlg::set_Mdc ( void  )

Set up the wires, layers and superlayers...

Definition at line 114 of file KalFitAlg2.cxx.

115{
116 MdcGeomSvc * mdcGeomSvc = dynamic_cast<MdcGeomSvc* >(imdcGeomSvc_);
117 if(! mdcGeomSvc) {
118 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitAlg2.cxx ..!!"<<std::endl;
119 }
120
121 if(debug_ == 4) {
122 cout << "KalFitAlg:: MDC initialisation " << std::endl;
123 }
124 _wire = NULL;
125 _layer = NULL;
126 _superLayer = NULL;
127
128 const int Nwire = mdcGeomSvc->getWireSize();
129 const int Nlyr = mdcGeomSvc->getLayerSize();
130 const int Nsup = mdcGeomSvc->getSuperLayerSize();
131
132 if (!Nwire || !Nlyr || !Nsup){
133 cout << ".....MdcGeom Objects are missing !! " << std::endl;
134 exit(-1);
135 }
136
137 if (!_wire)
138 _wire = (KalFitWire *) malloc((Nwire+1) * sizeof(KalFitWire));
139 if (!_layer)
140 _layer = (KalFitLayer_Mdc *) malloc(Nlyr * sizeof(KalFitLayer_Mdc));
141 if (!_superLayer)
142 _superLayer = (KalFitSuper_Mdc *) malloc(Nsup * sizeof(KalFitSuper_Mdc));
143
144 if (!_wire || !_layer || !_superLayer){
145 std::cerr << "KalFitAlg::Cannot allocate geometries" << std::endl;
146 std::cerr << "JOB will stop" << std::endl;
147 exit(-1);
148 }
149
150 int superLayerID = 0;
151 int layerID = 0;
152 int localLayerID = 0;
153 int localWireID = 0;
154 int localID = 0;
155 int wireID;
156
157 MdcGeoLayer * layer_back = NULL;
158 MdcGeoSuper * superLayer_back = NULL;
159 int k = 0;
160 int Nlayer[12];
161 int Nlocal[12];
162 int NlocalWireID[43];
163
164 for (wireID = 0;wireID <= Nwire; wireID++) {
165 MdcGeoLayer * layer = (wireID==Nwire) ? NULL : mdcGeomSvc->Wire(wireID)->Lyr();
166 if (layer != layer_back) {
167 layer_back = layer;
168 MdcGeoSuper * superLayer = (wireID==Nwire) ? NULL : mdcGeomSvc->Layer(layerID)->Sup();
169 if (superLayer != superLayer_back) {
170 superLayer_back = superLayer;
171 Nlayer[k] = localLayerID;
172 Nlocal[k] = localID;
173 localLayerID = 0;
174 k++;
175 }
176 NlocalWireID[layerID] = localWireID;
177 localID = 0;
178 localWireID = 0;
179 layerID++;
180 localLayerID++;
181 }
182 localID++;
183 localWireID++;
184 }
185
186 superLayerID = -1;
187 layerID = -1;
188 localLayerID = 0;
189 localID = 0;
190 layer_back = NULL;
191 superLayer_back = NULL;
192 for (wireID = 0;wireID < Nwire; wireID++) {
193 MdcGeoLayer * layer = (wireID==Nwire) ?
194 NULL : mdcGeomSvc->Wire(wireID)->Lyr();
195 if (layer != layer_back){
196 layer_back = layer;
197 MdcGeoSuper * superLayer = (wireID==Nwire) ?
198 NULL : mdcGeomSvc->Layer(layerID+1)->Sup();
199 if (superLayer != superLayer_back){
200 superLayer_back = superLayer;
201 // initialize super-layer
202 superLayerID++;
203 new(_superLayer+superLayerID) KalFitSuper_Mdc(wireID,
204 Nlocal[superLayerID+1],
205 layerID+1,
206 Nlayer[superLayerID+1],
207 superLayerID);
208 localLayerID=0;
209 }
210 // initialize layer
211 layerID++;
212 double slantWithSymbol = (mdcGeomSvc->Layer(layerID)->Slant())
213 *(mdcGeomSvc->Layer(layerID)->Sup()->Type());
214 new(_layer+layerID) KalFitLayer_Mdc(_superLayer[superLayerID],
215 0.1*layer->Radius(), (layer->Slant())*(layer->Sup()->Type()),
216 0.1*(layer->Length()/2),
217 0.1*(-layer->Length()/2), layer->Offset(),
218 layerID, localLayerID++ );
219 localID = 0;
220 }
221 // initialize wire
222
223 const MdcGeoWire * wire = (wireID==Nwire) ? NULL : mdcGeomSvc->Wire(wireID);
224 HepPoint3D fwd(0.1*wire->Backward());
225 HepPoint3D bck(0.1*wire->Forward());
226
227 if (superLayerID == 2 || superLayerID == 3 ||
228 superLayerID == 4 || superLayerID == 9 ||
229 superLayerID == 10) { // axial wire
230 new(_wire+wireID) KalFitWire(localID++,_layer[layerID],
231 fwd,bck, _wire+Nwire,wire->Id(),0);
232
233 } else { // stereo wire
234 new(_wire+wireID) KalFitWire(localID++,_layer[layerID],
235 fwd,bck, _wire+Nwire,wire->Id(),1);
236 }
237 }
238
239 // make virtual wire object for the pointer of boundary's neighbor
240 new(_wire+Nwire) KalFitWire();
241
242 if (debug_ == 4) cout << "MDC geometry reading done" << std::endl;
243
244 return;
245}
const int getSuperLayerSize()
Definition: MdcGeomSvc.cxx:681
const int getWireSize()
Definition: MdcGeomSvc.cxx:671
const int getLayerSize()
Definition: MdcGeomSvc.cxx:676

Referenced by beginRun().

◆ set_Mdc() [2/2]

void KalFitAlg::set_Mdc ( void  )

Set up the wires, layers and superlayers...

◆ setBesFromGdml() [1/2]

void KalFitAlg::setBesFromGdml ( void  )

— mdcgas

— CarbonFiber, Separator between ODC and Cgem

— Anode Kapton4

— Anode Cu3

— Anode Epoxy5

— Anode Rohacell2

— Anode Epoxy4

— Anode Kapton3

— Anode Epoxy3

— Anode Rohacell1

— Anode Epoxy2

— Anode Kapton2

—Anode Epoxy1

— Anode Cu2

— Anode Kapton1

— Anode Cu1

— Gap I

============================ Gem Foil2============================

— Foil Cu2

— Foil Kapton

— Foil Cu1

— Gap T2

— Foil Cu2

— Foil Kapton

— Foil Cu1

— Gap T1

— Foil Cu2

— Foil Kapton

— Foil Cu1

— Gap D

— Cathode

— Cathode Cu

— Cathode Kapton3

— Cathode Epoxy4

— Cathode Rohacell2

— Cathode Epoxy3

—Cathode Kapton2

— Cathode Epoxy2

— Cathode Rohacell1

— Cathode Epoxy1

— Cathode Kapton1

—air

air

outer beryllium pipe

cooling oil

inner beryllium pipe

gold

now construct the cylinders

Separator

shield kapton2

shield honeycomb

shield kapton1

Anode Kapton4

Anode Au2

Anode Cu3

Anode Epoxy5

Anode Rohacell2

Anode Epoxy4

Anode Kapton3

Anode Epoxy3

Anode Rohacell1

Anode Epoxy2

Anode Kapton2

Anode Epoxy1

Anode Cu2

Anode Cu1

Anode Au1

GAP I

Foil Gem2 Cu2

Kapton

Cu1

Gap T2

outer air, be attention the calculation of the radius and thick of the air cylinder is special

outer Beryllium layer

oil layer

inner Beryllium layer

gold layer

Definition at line 12 of file KalFitReadGdml.cxx.

12 {
13
14 int i(0);
15 double Z(0.),A(0.),Ionization(0.),Density(0.),Radlen(0.);
16
17 G4LogicalVolume *logicalMdc = 0;
18 MdcG4Geo* aMdcG4Geo = new MdcG4Geo();
19 logicalMdc = aMdcG4Geo->GetTopVolume();
20
21 ///--- mdcgas
22 G4Material* mdcMaterial = logicalMdc->GetMaterial();
23 for(i=0; i<mdcMaterial->GetElementVector()->size(); i++){
24 Z += (mdcMaterial->GetElement(i)->GetZ())*
25 (mdcMaterial->GetFractionVector()[i]);
26 A += (mdcMaterial->GetElement(i)->GetA())*
27 (mdcMaterial->GetFractionVector()[i]);
28 }
29 Ionization = mdcMaterial->GetIonisation()->GetMeanExcitationEnergy();
30 Density = mdcMaterial->GetDensity()/(g/cm3);
31 Radlen = mdcMaterial->GetRadlen();
32 cout<<"mdcgas: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
33 KalFitMaterial FitMdcMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
34 _BesKalmanFitMaterials.push_back(FitMdcMaterial);
35 KalFitTrack::mdcGasRadlen_ = Radlen/10.;
36 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
37 /*
38 ///--- inner wall shield fiml1 Al by wangll 2012-09-07
39 G4LogicalVolume* innerWallFilm1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("LogicalMdcInnerFilm1"));
40 G4Material* innerWallFilm1Material = innerWallFilm1Volume->GetMaterial();
41 G4Tubs* innerwallFilm1Tub = dynamic_cast<G4Tubs*>(innerWallFilm1Volume->GetSolid());
42
43 Z = 0.;
44 A = 0.;
45 for(i=0; i<innerWallFilm1Material->GetElementVector()->size(); i++){
46 Z += (innerWallFilm1Material->GetElement(i)->GetZ())*
47 (innerWallFilm1Material->GetFractionVector()[i]);
48 A += (innerWallFilm1Material->GetElement(i)->GetA())*
49 (innerWallFilm1Material->GetFractionVector()[i]);
50 }
51
52 Ionization = innerWallFilm1Material->GetIonisation()->GetMeanExcitationEnergy();
53 Density = innerWallFilm1Material->GetDensity()/(g/cm3);
54 Radlen = innerWallFilm1Material->GetRadlen();
55 std::cout<<"Mdc innerwall Film1, Al: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
56 KalFitMaterial FitInnerwallFilm1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
57 _BesKalmanFitMaterials.push_back(FitInnerwallFilm1Material);
58
59
60 ///--- inner wall CarbonFiber by wll 2012-09-06
61 G4LogicalVolume* innerwallVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalMdcSegment2"));
62 G4Material* innerwallMaterial = innerwallVolume->GetMaterial();
63 G4Tubs* innerwallTub = dynamic_cast<G4Tubs*>(innerwallVolume->GetSolid());
64
65 Z = 0.;
66 A = 0.;
67 for(i=0; i<innerwallMaterial->GetElementVector()->size(); i++){
68 Z += (innerwallMaterial->GetElement(i)->GetZ())*
69 (innerwallMaterial->GetFractionVector()[i]);
70 A += (innerwallMaterial->GetElement(i)->GetA())*
71 (innerwallMaterial->GetFractionVector()[i]);
72 }
73
74 Ionization = innerwallMaterial->GetIonisation()->GetMeanExcitationEnergy();
75 Density = innerwallMaterial->GetDensity()/(g/cm3);
76 Radlen = innerwallMaterial->GetRadlen();
77 cout<<"Mdc innerwall, Al: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
78 KalFitMaterial FitInnerwallMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
79 _BesKalmanFitMaterials.push_back(FitInnerwallMaterial);
80
81 ///--- inner wall shield film0 Al by wangll 2012-09-07
82 G4LogicalVolume* innerWallFilm0Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("LogicalMdcInnerFilm0"));
83 G4Material* innerWallFilm0Material = innerWallFilm0Volume->GetMaterial();
84 G4Tubs* innerwallFilm0Tub = dynamic_cast<G4Tubs*>(innerWallFilm0Volume->GetSolid());
85
86 Z = 0.;
87 A = 0.;
88 for(i=0; i<innerWallFilm0Material->GetElementVector()->size(); i++){
89 Z += (innerWallFilm0Material->GetElement(i)->GetZ())*
90 (innerWallFilm0Material->GetFractionVector()[i]);
91 A += (innerWallFilm0Material->GetElement(i)->GetA())*
92 (innerWallFilm0Material->GetFractionVector()[i]);
93 }
94
95 Ionization = innerWallFilm0Material->GetIonisation()->GetMeanExcitationEnergy();
96 Density = innerWallFilm0Material->GetDensity()/(g/cm3);
97 Radlen = innerWallFilm0Material->GetRadlen();
98 std::cout<<"Mdc innerwall Film0, Al: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<std::endl;
99 KalFitMaterial FitInnerwallFilm0Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
100 _BesKalmanFitMaterials.push_back(FitInnerwallFilm0Material);
101
102*/
103 //////////////////////////////////////////////////////////////////////////////////////////////////
104 G4LogicalVolume *logicalCgem = 0;
105 CgemG4Geo* aCgemG4Geo = new CgemG4Geo();
106 logicalCgem = aCgemG4Geo->GetTopVolume();
107
108 ///--- CarbonFiber, Separator between ODC and Cgem
109 G4LogicalVolume* SeparatorVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("Separator_logic"));
110 G4Material* SeparatorMaterial = SeparatorVolume->GetMaterial();
111 G4Tubs* SeparatorTub = dynamic_cast<G4Tubs*>(SeparatorVolume->GetSolid());
112
113 Z = 0.;
114 A = 0.;
115 for(i=0; i<SeparatorMaterial->GetElementVector()->size(); i++){
116 Z += (SeparatorMaterial->GetElement(i)->GetZ())*
117 (SeparatorMaterial->GetFractionVector()[i]);
118 A += (SeparatorMaterial->GetElement(i)->GetA())*
119 (SeparatorMaterial->GetFractionVector()[i]);
120 }
121
122 Ionization = SeparatorMaterial->GetIonisation()->GetMeanExcitationEnergy();
123 Density = SeparatorMaterial->GetDensity()/(g/cm3);
124 Radlen = SeparatorMaterial->GetRadlen();
125 cout<<"Separator: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
126 KalFitMaterial FitSeparatorMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
127 _BesKalmanFitMaterials.push_back(FitSeparatorMaterial);
128 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
129
130 int nCgemLayer = 3;
131 //G4Tubs* SK2Tub[3];
132 //G4Tubs* HCTub[3];
133 //G4Tubs* SK1Tub[3];
134 //G4Tubs* AA2Tub[3];
135 G4Tubs* AK4Tub[3];
136 G4Tubs* AC3Tub[3];
137 G4Tubs* AE5Tub[3];
138 G4Tubs* AR2Tub[3];
139 G4Tubs* AE4Tub[3];
140 G4Tubs* AK3Tub[3];
141 G4Tubs* AE3Tub[3];
142 G4Tubs* AR1Tub[3];
143 G4Tubs* AE2Tub[3];
144 G4Tubs* AK2Tub[3];
145 G4Tubs* AE1Tub[3];
146 G4Tubs* AC2Tub[3];
147 G4Tubs* AK1Tub[3];
148 G4Tubs* AC1Tub[3];
149 //G4Tubs* AA1Tub[3];
150
151 G4Tubs* GAPITub[3];
152
153 G4Tubs* FC22Tub[3];
154 G4Tubs* FK2Tub[3];
155 G4Tubs* FC12Tub[3];
156
157 G4Tubs* GAPT2Tub[3];
158
159 G4Tubs* FC21Tub[3];
160 G4Tubs* FK1Tub[3];
161 G4Tubs* FC11Tub[3];
162
163 G4Tubs* GAPT1Tub[3];
164
165 G4Tubs* FC20Tub[3];
166 G4Tubs* FK0Tub[3];
167 G4Tubs* FC10Tub[3];
168
169 G4Tubs* GAPDTub[3];
170
171 //G4Tubs* C2Tub[3];
172 G4Tubs* CCuTub[3];
173 G4Tubs* CK3Tub[3];
174 G4Tubs* CE4Tub[3];
175 G4Tubs* CR2Tub[3];
176 G4Tubs* CE3Tub[3];
177 G4Tubs* CK2Tub[3];
178 G4Tubs* CE2Tub[3];
179 G4Tubs* CR1Tub[3];
180 G4Tubs* CE1Tub[3];
181 //G4Tubs* CHTub[3];
182 //G4Tubs* CC1Tub[3];
183 G4Tubs* CK1Tub[3];
184
185 stringstream ss;
186 string s;
187 for(int j=2;j>=0;j--){
188 /*
189 ///--- shield kapton2
190 ss.str("");
191 ss << "Shield_Kapton2_logic" << j ;
192 s = ss.str();
193 G4LogicalVolume* logicalSK2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
194 G4Material* SK2Material = logicalSK2Volume->GetMaterial();
195 SK2Tub[j] = dynamic_cast<G4Tubs*>(logicalSK2Volume->GetSolid());
196 cout << logicalSK2Volume->GetSolid()->GetName() << endl;
197 Z = 0.;
198 A = 0.;
199 for(i=0; i<SK2Material->GetElementVector()->size(); i++){
200 Z += (SK2Material->GetElement(i)->GetZ())*
201 (SK2Material->GetFractionVector()[i]);
202 A += (SK2Material->GetElement(i)->GetA())*
203 (SK2Material->GetFractionVector()[i]);
204 }
205 Ionization = SK2Material->GetIonisation()->GetMeanExcitationEnergy();
206 Density = SK2Material->GetDensity()/(g/cm3);
207 Radlen = SK2Material->GetRadlen();
208 cout<<"SK2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
209
210 KalFitMaterial FitSK2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
211
212 _BesKalmanFitMaterials.push_back(FitSK2Material);
213 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
214 */
215 /*
216 ///--- shield honeycomb
217 ss.str("");
218 ss << "Shield_Honeycomb_logic" << j ;
219 s = ss.str();
220 cout << s << endl;
221 G4LogicalVolume* logicalHCVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
222 G4Material* HCMaterial = logicalHCVolume->GetMaterial();
223 HCTub[j] = dynamic_cast<G4Tubs*>(logicalHCVolume->GetSolid());
224 cout << logicalHCVolume->GetSolid()->GetName() << endl;
225 Z = 0.;
226 A = 0.;
227 for(i=0; i<HCMaterial->GetElementVector()->size(); i++){
228 Z += (HCMaterial->GetElement(i)->GetZ())*
229 (HCMaterial->GetFractionVector()[i]);
230 A += (HCMaterial->GetElement(i)->GetA())*
231 (HCMaterial->GetFractionVector()[i]);
232 }
233 Ionization = HCMaterial->GetIonisation()->GetMeanExcitationEnergy();
234 Density = HCMaterial->GetDensity()/(g/cm3);
235 Radlen = HCMaterial->GetRadlen();
236 cout<<"HC: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
237 KalFitMaterial FitHCMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
238 _BesKalmanFitMaterials.push_back(FitHCMaterial);
239 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
240 */
241 /*
242 ///--- shield kapton1
243 ss.str("");
244 ss << "Shield_Kapton1_logic" << j ;
245 s = ss.str();
246 G4LogicalVolume* logicalSK1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
247 G4Material* SK1Material = logicalSK1Volume->GetMaterial();
248 SK1Tub[j] = dynamic_cast<G4Tubs*>(logicalSK1Volume->GetSolid());
249 cout << logicalSK1Volume->GetSolid()->GetName() << endl;
250
251 Z = 0.;
252 A = 0.;
253 for(i=0; i<SK1Material->GetElementVector()->size(); i++){
254 Z += (SK1Material->GetElement(i)->GetZ())*
255 (SK1Material->GetFractionVector()[i]);
256 A += (SK1Material->GetElement(i)->GetA())*
257 (SK1Material->GetFractionVector()[i]);
258 }
259 Ionization = SK1Material->GetIonisation()->GetMeanExcitationEnergy();
260 Density = SK1Material->GetDensity()/(g/cm3);
261 Radlen = SK1Material->GetRadlen();
262 cout<<"SK1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
263 KalFitMaterial FitSK1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
264 _BesKalmanFitMaterials.push_back(FitSK1Material);
265 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
266 */
267 ///--- Anode Kapton4
268 ss.str("");
269 ss << "Anode_Kapton4_logic" << j ;
270 s = ss.str();
271 G4LogicalVolume* logicalAK4Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
272 G4Material* AK4Material = logicalAK4Volume->GetMaterial();
273 AK4Tub[j] = dynamic_cast<G4Tubs*>(logicalAK4Volume->GetSolid());
274 //cout << logicalAK4Volume->GetSolid()->GetName() << endl;
275
276 Z = 0.;
277 A = 0.;
278 for(i=0; i<AK4Material->GetElementVector()->size(); i++){
279 Z += (AK4Material->GetElement(i)->GetZ())*
280 (AK4Material->GetFractionVector()[i]);
281 A += (AK4Material->GetElement(i)->GetA())*
282 (AK4Material->GetFractionVector()[i]);
283 }
284 Ionization = AK4Material->GetIonisation()->GetMeanExcitationEnergy();
285 Density = AK4Material->GetDensity()/(g/cm3);
286 Radlen = AK4Material->GetRadlen();
287 cout<<"AK4: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
288 KalFitMaterial FitAK4Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
289 _BesKalmanFitMaterials.push_back(FitAK4Material);
290 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
291 /*
292 ///--- Anode Au2
293 ss.str("");
294 ss << "Anode_Au2_logic" << j ;
295 s = ss.str();
296 G4LogicalVolume* logicalAA2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
297 G4Material* AA2Material = logicalAA2Volume->GetMaterial();
298 AA2Tub[j] = dynamic_cast<G4Tubs*>(logicalAA2Volume->GetSolid());
299 Z = 0.;
300 A = 0.;
301 for(i=0; i<AA2Material->GetElementVector()->size(); i++){
302 Z += (AA2Material->GetElement(i)->GetZ())*
303 (AA2Material->GetFractionVector()[i]);
304 A += (AA2Material->GetElement(i)->GetA())*
305 (AA2Material->GetFractionVector()[i]);
306 }
307 Ionization = AA2Material->GetIonisation()->GetMeanExcitationEnergy();
308 Density = AA2Material->GetDensity()/(g/cm3);
309 Radlen = AA2Material->GetRadlen();
310 cout<<"AA2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
311 KalFitMaterial FitAA2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
312 _BesKalmanFitMaterials.push_back(FitAA2Material);
313 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
314 */
315 ///--- Anode Cu3
316 ss.str("");
317 ss << "Anode_Cu3_logic" << j ;
318 s = ss.str();
319 G4LogicalVolume* logicalAC3Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
320 G4Material* AC3Material = logicalAC3Volume->GetMaterial();
321 AC3Tub[j] = dynamic_cast<G4Tubs*>(logicalAC3Volume->GetSolid());
322 Z = 0.;
323 A = 0.;
324 for(i=0; i<AC3Material->GetElementVector()->size(); i++){
325 Z += (AC3Material->GetElement(i)->GetZ())*
326 (AC3Material->GetFractionVector()[i]);
327 A += (AC3Material->GetElement(i)->GetA())*
328 (AC3Material->GetFractionVector()[i]);
329 }
330 Ionization = AC3Material->GetIonisation()->GetMeanExcitationEnergy();
331 Density = AC3Material->GetDensity()/(g/cm3);
332 Radlen = AC3Material->GetRadlen();
333 cout<<"AC3: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
334 KalFitMaterial FitAC3Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
335 _BesKalmanFitMaterials.push_back(FitAC3Material);
336 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
337
338 ///--- Anode Epoxy5
339 ss.str("");
340 ss << "Anode_Epoxy5_logic" << j ;
341 s = ss.str();
342 G4LogicalVolume* logicalAE5Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
343 G4Material* AE5Material = logicalAE5Volume->GetMaterial();
344 AE5Tub[j] = dynamic_cast<G4Tubs*>(logicalAE5Volume->GetSolid());
345 Z = 0.;
346 A = 0.;
347 for(i=0; i<AE5Material->GetElementVector()->size(); i++){
348 Z += (AE5Material->GetElement(i)->GetZ())*
349 (AE5Material->GetFractionVector()[i]);
350 A += (AE5Material->GetElement(i)->GetA())*
351 (AE5Material->GetFractionVector()[i]);
352 }
353 Ionization = AE5Material->GetIonisation()->GetMeanExcitationEnergy();
354 Density = AE5Material->GetDensity()/(g/cm3);
355 Radlen = AE5Material->GetRadlen();
356 cout<<"AE5: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
357 KalFitMaterial FitAE5Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
358 _BesKalmanFitMaterials.push_back(FitAE5Material);
359 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
360
361 ///--- Anode Rohacell2
362 ss.str("");
363 ss << "Anode_Rohacell2_logic" << j ;
364 s = ss.str();
365 G4LogicalVolume* logicalAR2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
366 G4Material* AR2Material = logicalAR2Volume->GetMaterial();
367 AR2Tub[j] = dynamic_cast<G4Tubs*>(logicalAR2Volume->GetSolid());
368 Z = 0.;
369 A = 0.;
370 for(i=0; i<AR2Material->GetElementVector()->size(); i++){
371 Z += (AR2Material->GetElement(i)->GetZ())*
372 (AR2Material->GetFractionVector()[i]);
373 A += (AR2Material->GetElement(i)->GetA())*
374 (AR2Material->GetFractionVector()[i]);
375 }
376 Ionization = AR2Material->GetIonisation()->GetMeanExcitationEnergy();
377 Density = AR2Material->GetDensity()/(g/cm3);
378 Radlen = AR2Material->GetRadlen();
379 cout<<"AR2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
380 KalFitMaterial FitAR2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
381 _BesKalmanFitMaterials.push_back(FitAR2Material);
382 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
383
384 ///--- Anode Epoxy4
385 ss.str("");
386 ss << "Anode_Epoxy4_logic" << j ;
387 s = ss.str();
388 G4LogicalVolume* logicalAE4Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
389 G4Material* AE4Material = logicalAE4Volume->GetMaterial();
390 AE4Tub[j] = dynamic_cast<G4Tubs*>(logicalAE4Volume->GetSolid());
391 Z = 0.;
392 A = 0.;
393 for(i=0; i<AE4Material->GetElementVector()->size(); i++){
394 Z += (AE4Material->GetElement(i)->GetZ())*
395 (AE4Material->GetFractionVector()[i]);
396 A += (AE4Material->GetElement(i)->GetA())*
397 (AE4Material->GetFractionVector()[i]);
398 }
399 Ionization = AE4Material->GetIonisation()->GetMeanExcitationEnergy();
400 Density = AE4Material->GetDensity()/(g/cm3);
401 Radlen = AE4Material->GetRadlen();
402 cout<<"AE4: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
403 KalFitMaterial FitAE4Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
404 _BesKalmanFitMaterials.push_back(FitAE4Material);
405 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
406
407 ///--- Anode Kapton3
408 ss.str("");
409 ss << "Anode_Kapton3_logic" << j ;
410 s = ss.str();
411 G4LogicalVolume* logicalAK3Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
412 G4Material* AK3Material = logicalAK3Volume->GetMaterial();
413 AK3Tub[j] = dynamic_cast<G4Tubs*>(logicalAK3Volume->GetSolid());
414 Z = 0.;
415 A = 0.;
416 for(i=0; i<AK3Material->GetElementVector()->size(); i++){
417 Z += (AK3Material->GetElement(i)->GetZ())*
418 (AK3Material->GetFractionVector()[i]);
419 A += (AK3Material->GetElement(i)->GetA())*
420 (AK3Material->GetFractionVector()[i]);
421 }
422 Ionization = AK3Material->GetIonisation()->GetMeanExcitationEnergy();
423 Density = AK3Material->GetDensity()/(g/cm3);
424 Radlen = AK3Material->GetRadlen();
425 cout<<"AK3: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
426 KalFitMaterial FitAK3Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
427 _BesKalmanFitMaterials.push_back(FitAK3Material);
428 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
429
430 ///--- Anode Epoxy3
431 ss.str("");
432 ss << "Anode_Epoxy3_logic" << j ;
433 s = ss.str();
434 G4LogicalVolume* logicalAE3Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
435 G4Material* AE3Material = logicalAE3Volume->GetMaterial();
436 AE3Tub[j] = dynamic_cast<G4Tubs*>(logicalAE3Volume->GetSolid());
437 Z = 0.;
438 A = 0.;
439 for(i=0; i<AE3Material->GetElementVector()->size(); i++){
440 Z += (AE3Material->GetElement(i)->GetZ())*
441 (AE3Material->GetFractionVector()[i]);
442 A += (AE3Material->GetElement(i)->GetA())*
443 (AE3Material->GetFractionVector()[i]);
444 }
445 Ionization = AE3Material->GetIonisation()->GetMeanExcitationEnergy();
446 Density = AE3Material->GetDensity()/(g/cm3);
447 Radlen = AE3Material->GetRadlen();
448 cout<<"AE3: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
449 KalFitMaterial FitAE3Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
450 _BesKalmanFitMaterials.push_back(FitAE3Material);
451 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
452
453 ///--- Anode Rohacell1
454 ss.str("");
455 ss << "Anode_Rohacell1_logic" << j ;
456 s = ss.str();
457 G4LogicalVolume* logicalAR1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
458 G4Material* AR1Material = logicalAR1Volume->GetMaterial();
459 AR1Tub[j] = dynamic_cast<G4Tubs*>(logicalAR1Volume->GetSolid());
460 Z = 0.;
461 A = 0.;
462 for(i=0; i<AR1Material->GetElementVector()->size(); i++){
463 Z += (AR1Material->GetElement(i)->GetZ())*
464 (AR1Material->GetFractionVector()[i]);
465 A += (AR1Material->GetElement(i)->GetA())*
466 (AR1Material->GetFractionVector()[i]);
467 }
468 Ionization = AR1Material->GetIonisation()->GetMeanExcitationEnergy();
469 Density = AR1Material->GetDensity()/(g/cm3);
470 Radlen = AR1Material->GetRadlen();
471 cout<<"AR1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
472 KalFitMaterial FitAR1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
473 _BesKalmanFitMaterials.push_back(FitAR1Material);
474 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
475
476 ///--- Anode Epoxy2
477 ss.str("");
478 ss << "Anode_Epoxy2_logic" << j ;
479 s = ss.str();
480 G4LogicalVolume* logicalAE2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
481 G4Material* AE2Material = logicalAE2Volume->GetMaterial();
482 AE2Tub[j] = dynamic_cast<G4Tubs*>(logicalAE2Volume->GetSolid());
483 Z = 0.;
484 A = 0.;
485 for(i=0; i<AE2Material->GetElementVector()->size(); i++){
486 Z += (AE2Material->GetElement(i)->GetZ())*
487 (AE2Material->GetFractionVector()[i]);
488 A += (AE2Material->GetElement(i)->GetA())*
489 (AE2Material->GetFractionVector()[i]);
490 }
491 Ionization = AE2Material->GetIonisation()->GetMeanExcitationEnergy();
492 Density = AE2Material->GetDensity()/(g/cm3);
493 Radlen = AE2Material->GetRadlen();
494 cout<<"AE2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
495 KalFitMaterial FitAE2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
496 _BesKalmanFitMaterials.push_back(FitAE2Material);
497 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
498
499 ///--- Anode Kapton2
500 ss.str("");
501 ss << "Anode_Kapton2_logic" << j ;
502 s = ss.str();
503 G4LogicalVolume* logicalAK2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
504 G4Material* AK2Material = logicalAK2Volume->GetMaterial();
505 AK2Tub[j] = dynamic_cast<G4Tubs*>(logicalAK2Volume->GetSolid());
506 Z = 0.;
507 A = 0.;
508 for(i=0; i<AK2Material->GetElementVector()->size(); i++){
509 Z += (AK2Material->GetElement(i)->GetZ())*
510 (AK2Material->GetFractionVector()[i]);
511 A += (AK2Material->GetElement(i)->GetA())*
512 (AK2Material->GetFractionVector()[i]);
513 }
514 Ionization = AK2Material->GetIonisation()->GetMeanExcitationEnergy();
515 Density = AK2Material->GetDensity()/(g/cm3);
516 Radlen = AK2Material->GetRadlen();
517 cout<<"AK2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
518 KalFitMaterial FitAK2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
519 _BesKalmanFitMaterials.push_back(FitAK2Material);
520 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
521
522 ///---Anode Epoxy1
523 ss.str("");
524 ss << "Anode_Epoxy1_logic" << j ;
525 s = ss.str();
526 G4LogicalVolume* logicalAE1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
527 G4Material* AE1Material = logicalAE1Volume->GetMaterial();
528 AE1Tub[j] = dynamic_cast<G4Tubs*>(logicalAE1Volume->GetSolid());
529 Z = 0.;
530 A = 0.;
531 for(i=0; i<AE1Material->GetElementVector()->size(); i++){
532 Z += (AE1Material->GetElement(i)->GetZ())*
533 (AE1Material->GetFractionVector()[i]);
534 A += (AE1Material->GetElement(i)->GetA())*
535 (AE1Material->GetFractionVector()[i]);
536 }
537 Ionization = AE1Material->GetIonisation()->GetMeanExcitationEnergy();
538 Density = AE1Material->GetDensity()/(g/cm3);
539 Radlen = AE1Material->GetRadlen();
540 cout<<"AE1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
541 KalFitMaterial FitAE1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
542 _BesKalmanFitMaterials.push_back(FitAE1Material);
543 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
544
545 ///--- Anode Cu2
546 ss.str("");
547 ss << "Anode_Cu2_logic" << j ;
548 s = ss.str();
549 G4LogicalVolume* logicalAC2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
550 G4Material* AC2Material = logicalAC2Volume->GetMaterial();
551 AC2Tub[j] = dynamic_cast<G4Tubs*>(logicalAC2Volume->GetSolid());
552 Z = 0.;
553 A = 0.;
554 for(i=0; i<AC2Material->GetElementVector()->size(); i++){
555 Z += (AC2Material->GetElement(i)->GetZ())*
556 (AC2Material->GetFractionVector()[i]);
557 A += (AC2Material->GetElement(i)->GetA())*
558 (AC2Material->GetFractionVector()[i]);
559 }
560 Ionization = AC2Material->GetIonisation()->GetMeanExcitationEnergy();
561 Density = AC2Material->GetDensity()/(g/cm3);
562 Radlen = AC2Material->GetRadlen();
563 cout<<"AC2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
564 KalFitMaterial FitAC2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
565 _BesKalmanFitMaterials.push_back(FitAC2Material);
566 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
567
568 ///--- Anode Kapton1
569 ss.str("");
570 ss << "Anode_Kapton1_logic" << j ;
571 s = ss.str();
572 G4LogicalVolume* logicalAK1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
573 G4Material* AK1Material = logicalAK1Volume->GetMaterial();
574 AK1Tub[j] = dynamic_cast<G4Tubs*>(logicalAK1Volume->GetSolid());
575 Z = 0.;
576 A = 0.;
577 for(i=0; i<AK1Material->GetElementVector()->size(); i++){
578 Z += (AK1Material->GetElement(i)->GetZ())*
579 (AK1Material->GetFractionVector()[i]);
580 A += (AK1Material->GetElement(i)->GetA())*
581 (AK1Material->GetFractionVector()[i]);
582 }
583 Ionization = AK1Material->GetIonisation()->GetMeanExcitationEnergy();
584 Density = AK1Material->GetDensity()/(g/cm3);
585 Radlen = AK1Material->GetRadlen();
586 cout<<"AK1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
587 KalFitMaterial FitAK1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
588 _BesKalmanFitMaterials.push_back(FitAK1Material);
589 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
590
591 ///--- Anode Cu1
592 ss.str("");
593 ss << "Anode_Cu1_logic" << j ;
594 s = ss.str();
595 G4LogicalVolume* logicalAC1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
596 G4Material* AC1Material = logicalAC1Volume->GetMaterial();
597 AC1Tub[j] = dynamic_cast<G4Tubs*>(logicalAC1Volume->GetSolid());
598 Z = 0.;
599 A = 0.;
600 for(i=0; i<AC1Material->GetElementVector()->size(); i++){
601 Z += (AC1Material->GetElement(i)->GetZ())*
602 (AC1Material->GetFractionVector()[i]);
603 A += (AC1Material->GetElement(i)->GetA())*
604 (AC1Material->GetFractionVector()[i]);
605 }
606 Ionization = AC1Material->GetIonisation()->GetMeanExcitationEnergy();
607 Density = AC1Material->GetDensity()/(g/cm3);
608 Radlen = AC1Material->GetRadlen();
609 cout<<"AC1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
610 KalFitMaterial FitAC1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
611 _BesKalmanFitMaterials.push_back(FitAC1Material);
612 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
613 /*
614 ///--- Anode Au1
615 ss.str("");
616 ss << "Anode_Au1_logic" << j ;
617 s = ss.str();
618 G4LogicalVolume* logicalAA1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
619 G4Material* AA1Material = logicalAA1Volume->GetMaterial();
620 AA1Tub[j] = dynamic_cast<G4Tubs*>(logicalAA1Volume->GetSolid());
621 Z = 0.;
622 A = 0.;
623 for(i=0; i<AA1Material->GetElementVector()->size(); i++){
624 Z += (AA1Material->GetElement(i)->GetZ())*
625 (AA1Material->GetFractionVector()[i]);
626 A += (AA1Material->GetElement(i)->GetA())*
627 (AA1Material->GetFractionVector()[i]);
628 }
629 Ionization = AA1Material->GetIonisation()->GetMeanExcitationEnergy();
630 Density = AA1Material->GetDensity()/(g/cm3);
631 Radlen = AA1Material->GetRadlen();
632 cout<<"AA1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
633 KalFitMaterial FitAA1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
634 _BesKalmanFitMaterials.push_back(FitAA1Material);
635 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
636 */
637 ///--- Gap I
638 ss.str("");
639 ss << "Gap_I_logic" << j;
640 s = ss.str();
641 G4LogicalVolume* logicalGAPIVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
642 G4Material* GAPIMaterial = logicalGAPIVolume->GetMaterial();
643 GAPITub[j] = dynamic_cast<G4Tubs*>(logicalGAPIVolume->GetSolid());
644 Z = 0.;
645 A = 0.;
646 for(i=0; i<GAPIMaterial->GetElementVector()->size(); i++){
647 Z += (GAPIMaterial->GetElement(i)->GetZ())*
648 (GAPIMaterial->GetFractionVector()[i]);
649 A += (GAPIMaterial->GetElement(i)->GetA())*
650 (GAPIMaterial->GetFractionVector()[i]);
651 }
652 Ionization = GAPIMaterial->GetIonisation()->GetMeanExcitationEnergy();
653 Density = GAPIMaterial->GetDensity()/(g/cm3);
654 Radlen = GAPIMaterial->GetRadlen();
655 cout<<"GAPI: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
656 KalFitMaterial FitGAPIMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
657 _BesKalmanFitMaterials.push_back(FitGAPIMaterial);
658 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
659
660 ///============================ Gem Foil2============================
661
662 ///--- Foil Cu2
663 ss.str("");
664 ss << "GemFoil_Cu2_logic" << j << "foil2" ;
665 s = ss.str();
666 G4LogicalVolume* logicalFC22Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
667 G4Material* FC22Material = logicalFC22Volume->GetMaterial();
668 FC22Tub[j] = dynamic_cast<G4Tubs*>(logicalFC22Volume->GetSolid());
669 Z = 0.;
670 A = 0.;
671 for(i=0; i<FC22Material->GetElementVector()->size(); i++){
672 Z += (FC22Material->GetElement(i)->GetZ())*
673 (FC22Material->GetFractionVector()[i]);
674 A += (FC22Material->GetElement(i)->GetA())*
675 (FC22Material->GetFractionVector()[i]);
676 }
677 Ionization = FC22Material->GetIonisation()->GetMeanExcitationEnergy();
678 Density = FC22Material->GetDensity()/(g/cm3);
679 Radlen = FC22Material->GetRadlen();
680 cout<<"FC22: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
681 KalFitMaterial FitFC22Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
682 _BesKalmanFitMaterials.push_back(FitFC22Material);
683 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
684
685 ///--- Foil Kapton
686 ss.str("");
687 ss << "GemFoil_Kapton_logic" << j << "foil2" ;
688 s = ss.str();
689 G4LogicalVolume* logicalFK2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
690 G4Material* FK2Material = logicalFK2Volume->GetMaterial();
691 FK2Tub[j] = dynamic_cast<G4Tubs*>(logicalFK2Volume->GetSolid());
692 Z = 0.;
693 A = 0.;
694 for(i=0; i<FK2Material->GetElementVector()->size(); i++){
695 Z += (FK2Material->GetElement(i)->GetZ())*
696 (FK2Material->GetFractionVector()[i]);
697 A += (FK2Material->GetElement(i)->GetA())*
698 (FK2Material->GetFractionVector()[i]);
699 }
700 Ionization = FK2Material->GetIonisation()->GetMeanExcitationEnergy();
701 Density = FK2Material->GetDensity()/(g/cm3);
702 Radlen = FK2Material->GetRadlen();
703 cout<<"FK2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
704 KalFitMaterial FitFK2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
705 _BesKalmanFitMaterials.push_back(FitFK2Material);
706 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
707
708 ///--- Foil Cu1
709 ss.str("");
710 ss << "GemFoil_Cu1_logic" << j << "foil2" ;
711 s = ss.str();
712 G4LogicalVolume* logicalFC12Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
713 G4Material* FC12Material = logicalFC12Volume->GetMaterial();
714 FC12Tub[j] = dynamic_cast<G4Tubs*>(logicalFC12Volume->GetSolid());
715 Z = 0.;
716 A = 0.;
717 for(i=0; i<FC12Material->GetElementVector()->size(); i++){
718 Z += (FC12Material->GetElement(i)->GetZ())*
719 (FC12Material->GetFractionVector()[i]);
720 A += (FC12Material->GetElement(i)->GetA())*
721 (FC12Material->GetFractionVector()[i]);
722 }
723 Ionization = FC12Material->GetIonisation()->GetMeanExcitationEnergy();
724 Density = FC12Material->GetDensity()/(g/cm3);
725 Radlen = FC12Material->GetRadlen();
726 cout<<"FC12: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
727 KalFitMaterial FitFC12Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
728 _BesKalmanFitMaterials.push_back(FitFC12Material);
729 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
730
731 ///--- Gap T2
732 ss.str("");
733 ss << "Gap_T2_logic" << j ;
734 s = ss.str();
735 G4LogicalVolume* logicalGAPT2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
736 G4Material* GAPT2Material = logicalGAPT2Volume->GetMaterial();
737 GAPT2Tub[j] = dynamic_cast<G4Tubs*>(logicalGAPT2Volume->GetSolid());
738 Z = 0.;
739 A = 0.;
740 for(i=0; i<GAPT2Material->GetElementVector()->size(); i++){
741 Z += (GAPT2Material->GetElement(i)->GetZ())*
742 (GAPT2Material->GetFractionVector()[i]);
743 A += (GAPT2Material->GetElement(i)->GetA())*
744 (GAPT2Material->GetFractionVector()[i]);
745 }
746 Ionization = GAPT2Material->GetIonisation()->GetMeanExcitationEnergy();
747 Density = GAPT2Material->GetDensity()/(g/cm3);
748 Radlen = GAPT2Material->GetRadlen();
749 cout<<"GAPT2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
750 KalFitMaterial FitGAPT2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
751 _BesKalmanFitMaterials.push_back(FitGAPT2Material);
752 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
753
754 //======================================== Gem Foil1=========================================
755 ///--- Foil Cu2
756 ss.str("");
757 ss << "GemFoil_Cu2_logic" << j << "foil1" ;
758 s = ss.str();
759 G4LogicalVolume* logicalFC21Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
760 G4Material* FC21Material = logicalFC21Volume->GetMaterial();
761 FC21Tub[j] = dynamic_cast<G4Tubs*>(logicalFC21Volume->GetSolid());
762 Z = 0.;
763 A = 0.;
764 for(i=0; i<FC21Material->GetElementVector()->size(); i++){
765 Z += (FC21Material->GetElement(i)->GetZ())*
766 (FC21Material->GetFractionVector()[i]);
767 A += (FC21Material->GetElement(i)->GetA())*
768 (FC21Material->GetFractionVector()[i]);
769 }
770 Ionization = FC21Material->GetIonisation()->GetMeanExcitationEnergy();
771 Density = FC21Material->GetDensity()/(g/cm3);
772 Radlen = FC21Material->GetRadlen();
773 cout<<"FC21: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
774 KalFitMaterial FitFC21Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
775 _BesKalmanFitMaterials.push_back(FitFC21Material);
776 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
777
778 ///--- Foil Kapton
779 ss.str("");
780 ss << "GemFoil_Kapton_logic" << j << "foil1" ;
781 s = ss.str();
782 G4LogicalVolume* logicalFK1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
783 G4Material* FK1Material = logicalFK1Volume->GetMaterial();
784 FK1Tub[j] = dynamic_cast<G4Tubs*>(logicalFK1Volume->GetSolid());
785 Z = 0.;
786 A = 0.;
787 for(i=0; i<FK1Material->GetElementVector()->size(); i++){
788 Z += (FK1Material->GetElement(i)->GetZ())*
789 (FK1Material->GetFractionVector()[i]);
790 A += (FK1Material->GetElement(i)->GetA())*
791 (FK1Material->GetFractionVector()[i]);
792 }
793 Ionization = FK1Material->GetIonisation()->GetMeanExcitationEnergy();
794 Density = FK1Material->GetDensity()/(g/cm3);
795 Radlen = FK1Material->GetRadlen();
796 cout<<"FK1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
797 KalFitMaterial FitFK1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
798 _BesKalmanFitMaterials.push_back(FitFK1Material);
799 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
800
801 ///--- Foil Cu1
802 ss.str("");
803 ss << "GemFoil_Cu1_logic" << j << "foil1" ;
804 s = ss.str();
805 G4LogicalVolume* logicalFC11Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
806 G4Material* FC11Material = logicalFC11Volume->GetMaterial();
807 FC11Tub[j] = dynamic_cast<G4Tubs*>(logicalFC11Volume->GetSolid());
808 Z = 0.;
809 A = 0.;
810 for(i=0; i<FC11Material->GetElementVector()->size(); i++){
811 Z += (FC11Material->GetElement(i)->GetZ())*
812 (FC11Material->GetFractionVector()[i]);
813 A += (FC11Material->GetElement(i)->GetA())*
814 (FC11Material->GetFractionVector()[i]);
815 }
816 Ionization = FC11Material->GetIonisation()->GetMeanExcitationEnergy();
817 Density = FC11Material->GetDensity()/(g/cm3);
818 Radlen = FC11Material->GetRadlen();
819 cout<<"FC11: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
820 KalFitMaterial FitFC11Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
821 _BesKalmanFitMaterials.push_back(FitFC11Material);
822 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
823
824 ///--- Gap T1
825 ss.str("");
826 ss << "Gap_T1_logic" << j ;
827 s = ss.str();
828 G4LogicalVolume* logicalGAPT1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
829 G4Material* GAPT1Material = logicalGAPT1Volume->GetMaterial();
830 GAPT1Tub[j] = dynamic_cast<G4Tubs*>(logicalGAPT1Volume->GetSolid());
831 Z = 0.;
832 A = 0.;
833 for(i=0; i<GAPT1Material->GetElementVector()->size(); i++){
834 Z += (GAPT1Material->GetElement(i)->GetZ())*
835 (GAPT1Material->GetFractionVector()[i]);
836 A += (GAPT1Material->GetElement(i)->GetA())*
837 (GAPT1Material->GetFractionVector()[i]);
838 }
839 Ionization = GAPT1Material->GetIonisation()->GetMeanExcitationEnergy();
840 Density = GAPT1Material->GetDensity()/(g/cm3);
841 Radlen = GAPT1Material->GetRadlen();
842 cout<<"GAPT1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
843 KalFitMaterial FitGAPT1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
844 _BesKalmanFitMaterials.push_back(FitGAPT1Material);
845 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
846
847 //============================ Gem Foil0================================
848 ///--- Foil Cu2
849 ss.str("");
850 ss << "GemFoil_Cu2_logic" << j << "foil0" ;
851 s = ss.str();
852 G4LogicalVolume* logicalFC20Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
853 G4Material* FC20Material = logicalFC20Volume->GetMaterial();
854 FC20Tub[j] = dynamic_cast<G4Tubs*>(logicalFC20Volume->GetSolid());
855 Z = 0.;
856 A = 0.;
857 for(i=0; i<FC20Material->GetElementVector()->size(); i++){
858 Z += (FC20Material->GetElement(i)->GetZ())*
859 (FC20Material->GetFractionVector()[i]);
860 A += (FC20Material->GetElement(i)->GetA())*
861 (FC20Material->GetFractionVector()[i]);
862 }
863 Ionization = FC20Material->GetIonisation()->GetMeanExcitationEnergy();
864 Density = FC20Material->GetDensity()/(g/cm3);
865 Radlen = FC20Material->GetRadlen();
866 cout<<"FC20: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
867 KalFitMaterial FitFC20Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
868 _BesKalmanFitMaterials.push_back(FitFC20Material);
869 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
870
871 ///--- Foil Kapton
872 ss.str("");
873 ss << "GemFoil_Kapton_logic" << j << "foil0" ;
874 s = ss.str();
875 G4LogicalVolume* logicalFK0Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
876 G4Material* FK0Material = logicalFK0Volume->GetMaterial();
877 FK0Tub[j] = dynamic_cast<G4Tubs*>(logicalFK0Volume->GetSolid());
878 Z = 0.;
879 A = 0.;
880 for(i=0; i<FK0Material->GetElementVector()->size(); i++){
881 Z += (FK0Material->GetElement(i)->GetZ())*
882 (FK0Material->GetFractionVector()[i]);
883 A += (FK0Material->GetElement(i)->GetA())*
884 (FK0Material->GetFractionVector()[i]);
885 }
886 Ionization = FK0Material->GetIonisation()->GetMeanExcitationEnergy();
887 Density = FK0Material->GetDensity()/(g/cm3);
888 Radlen = FK0Material->GetRadlen();
889 cout<<"FK0: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
890 KalFitMaterial FitFK0Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
891 _BesKalmanFitMaterials.push_back(FitFK0Material);
892 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
893
894 ///--- Foil Cu1
895 ss.str("");
896 ss << "GemFoil_Cu1_logic" << j<< "foil0" ;
897 s = ss.str();
898 G4LogicalVolume* logicalFC10Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
899 G4Material* FC10Material = logicalFC10Volume->GetMaterial();
900 FC10Tub[j] = dynamic_cast<G4Tubs*>(logicalFC10Volume->GetSolid());
901 Z = 0.;
902 A = 0.;
903 for(i=0; i<FC10Material->GetElementVector()->size(); i++){
904 Z += (FC10Material->GetElement(i)->GetZ())*
905 (FC10Material->GetFractionVector()[i]);
906 A += (FC10Material->GetElement(i)->GetA())*
907 (FC10Material->GetFractionVector()[i]);
908 }
909 Ionization = FC10Material->GetIonisation()->GetMeanExcitationEnergy();
910 Density = FC10Material->GetDensity()/(g/cm3);
911 Radlen = FC10Material->GetRadlen();
912 cout<<"FC10: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
913 KalFitMaterial FitFC10Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
914 _BesKalmanFitMaterials.push_back(FitFC10Material);
915 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
916
917 ///--- Gap D
918 ss.str("");
919 ss << "Gap_D_logic" << j ;
920 s = ss.str();
921 G4LogicalVolume* logicalGAPDVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
922 G4Material* GAPDMaterial = logicalGAPDVolume->GetMaterial();
923 GAPDTub[j] = dynamic_cast<G4Tubs*>(logicalGAPDVolume->GetSolid());
924 Z = 0.;
925 A = 0.;
926 for(i=0; i<GAPDMaterial->GetElementVector()->size(); i++){
927 Z += (GAPDMaterial->GetElement(i)->GetZ())*
928 (GAPDMaterial->GetFractionVector()[i]);
929 A += (GAPDMaterial->GetElement(i)->GetA())*
930 (GAPDMaterial->GetFractionVector()[i]);
931 }
932 Ionization = GAPDMaterial->GetIonisation()->GetMeanExcitationEnergy();
933 Density = GAPDMaterial->GetDensity()/(g/cm3);
934 Radlen = GAPDMaterial->GetRadlen();
935 cout<<"GAPD: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
936 KalFitMaterial FitGAPDMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
937 _BesKalmanFitMaterials.push_back(FitGAPDMaterial);
938 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
939 ///--- Cathode
940 /*ss.str("");
941 ss << "Cathode_logic" << j;
942 s = ss.str();
943 G4LogicalVolume* logicalC2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
944 G4Material* C2Material = logicalC2Volume->GetMaterial();
945 C2Tub[j] = dynamic_cast<G4Tubs*>(logicalC2Volume->GetSolid());
946 Z = 0.;
947 A = 0.;
948 for(i=0; i<C2Material->GetElementVector()->size(); i++){
949 Z += (C2Material->GetElement(i)->GetZ())*
950 (C2Material->GetFractionVector()[i]);
951 A += (C2Material->GetElement(i)->GetA())*
952 (C2Material->GetFractionVector()[i]);
953 }
954 Ionization = C2Material->GetIonisation()->GetMeanExcitationEnergy();
955 Density = C2Material->GetDensity()/(g/cm3);
956 Radlen = C2Material->GetRadlen();
957 cout<<"C2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
958 KalFitMaterial FitC2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
959 _BesKalmanFitMaterials.push_back(FitC2Material);
960 */
961
962 ///--- Cathode Cu
963 ss.str("");
964 ss << "Cathode_Cu_logic" << j ;
965 s = ss.str();
966 G4LogicalVolume* logicalCCuVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
967 G4Material* CCuMaterial = logicalCCuVolume->GetMaterial();
968 CCuTub[j] = dynamic_cast<G4Tubs*>(logicalCCuVolume->GetSolid());
969 Z = 0.;
970 A = 0.;
971 for(i=0; i<CCuMaterial->GetElementVector()->size(); i++){
972 Z += (CCuMaterial->GetElement(i)->GetZ())*
973 (CCuMaterial->GetFractionVector()[i]);
974 A += (CCuMaterial->GetElement(i)->GetA())*
975 (CCuMaterial->GetFractionVector()[i]);
976 }
977 Ionization = CCuMaterial->GetIonisation()->GetMeanExcitationEnergy();
978 Density = CCuMaterial->GetDensity()/(g/cm3);
979 Radlen = CCuMaterial->GetRadlen();
980 cout<<"CCu: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
981 KalFitMaterial FitCCuMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
982 _BesKalmanFitMaterials.push_back(FitCCuMaterial);
983 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
984
985 ///--- Cathode Kapton3
986 ss.str("");
987 ss << "Cathode_Kapton3_logic" << j ;
988 s = ss.str();
989 G4LogicalVolume* logicalCK3Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
990 G4Material* CK3Material = logicalCK3Volume->GetMaterial();
991 CK3Tub[j] = dynamic_cast<G4Tubs*>(logicalCK3Volume->GetSolid());
992 Z = 0.;
993 A = 0.;
994 for(i=0; i<CK3Material->GetElementVector()->size(); i++){
995 Z += (CK3Material->GetElement(i)->GetZ())*
996 (CK3Material->GetFractionVector()[i]);
997 A += (CK3Material->GetElement(i)->GetA())*
998 (CK3Material->GetFractionVector()[i]);
999 }
1000 Ionization = CK3Material->GetIonisation()->GetMeanExcitationEnergy();
1001 Density = CK3Material->GetDensity()/(g/cm3);
1002 Radlen = CK3Material->GetRadlen();
1003 cout<<"CK3: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1004 KalFitMaterial FitCK3Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1005 _BesKalmanFitMaterials.push_back(FitCK3Material);
1006 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1007
1008 ///--- Cathode Epoxy4
1009 ss.str("");
1010 ss << "Cathode_Epoxy4_logic" << j ;
1011 s = ss.str();
1012 G4LogicalVolume* logicalCE4Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1013 G4Material* CE4Material = logicalCE4Volume->GetMaterial();
1014 CE4Tub[j] = dynamic_cast<G4Tubs*>(logicalCE4Volume->GetSolid());
1015 Z = 0.;
1016 A = 0.;
1017 for(i=0; i<CE4Material->GetElementVector()->size(); i++){
1018 Z += (CE4Material->GetElement(i)->GetZ())*
1019 (CE4Material->GetFractionVector()[i]);
1020 A += (CE4Material->GetElement(i)->GetA())*
1021 (CE4Material->GetFractionVector()[i]);
1022 }
1023 Ionization = CE4Material->GetIonisation()->GetMeanExcitationEnergy();
1024 Density = CE4Material->GetDensity()/(g/cm3);
1025 Radlen = CE4Material->GetRadlen();
1026 cout<<"CE4: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1027 KalFitMaterial FitCE4Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1028 _BesKalmanFitMaterials.push_back(FitCE4Material);
1029 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1030
1031
1032 ///--- Cathode Rohacell2
1033 ss.str("");
1034 ss << "Cathode_Rohacell2_logic" << j ;
1035 s = ss.str();
1036 G4LogicalVolume* logicalCR2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1037 G4Material* CR2Material = logicalCR2Volume->GetMaterial();
1038 CR2Tub[j] = dynamic_cast<G4Tubs*>(logicalCR2Volume->GetSolid());
1039 Z = 0.;
1040 A = 0.;
1041 for(i=0; i<CR2Material->GetElementVector()->size(); i++){
1042 Z += (CR2Material->GetElement(i)->GetZ())*
1043 (CR2Material->GetFractionVector()[i]);
1044 A += (CR2Material->GetElement(i)->GetA())*
1045 (CR2Material->GetFractionVector()[i]);
1046 }
1047 Ionization = CR2Material->GetIonisation()->GetMeanExcitationEnergy();
1048 Density = CR2Material->GetDensity()/(g/cm3);
1049 Radlen = CR2Material->GetRadlen();
1050 cout<<"CR2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1051 KalFitMaterial FitCR2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1052 _BesKalmanFitMaterials.push_back(FitCR2Material);
1053 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1054
1055 ///--- Cathode Epoxy3
1056 ss.str("");
1057 ss << "Cathode_Epoxy3_logic" << j ;
1058 s = ss.str();
1059 G4LogicalVolume* logicalCE3Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1060 G4Material* CE3Material = logicalCE3Volume->GetMaterial();
1061 CE3Tub[j] = dynamic_cast<G4Tubs*>(logicalCE3Volume->GetSolid());
1062 Z = 0.;
1063 A = 0.;
1064 for(i=0; i<CE3Material->GetElementVector()->size(); i++){
1065 Z += (CE3Material->GetElement(i)->GetZ())*
1066 (CE3Material->GetFractionVector()[i]);
1067 A += (CE3Material->GetElement(i)->GetA())*
1068 (CE3Material->GetFractionVector()[i]);
1069 }
1070 Ionization = CE3Material->GetIonisation()->GetMeanExcitationEnergy();
1071 Density = CE3Material->GetDensity()/(g/cm3);
1072 Radlen = CE3Material->GetRadlen();
1073 cout<<"CE3: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1074 KalFitMaterial FitCE3Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1075 _BesKalmanFitMaterials.push_back(FitCE3Material);
1076 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1077
1078 ///---Cathode Kapton2
1079 ss.str("");
1080 ss << "Cathode_Kapton2_logic" << j ;
1081 s = ss.str();
1082 G4LogicalVolume* logicalCK2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1083 G4Material* CK2Material = logicalCK2Volume->GetMaterial();
1084 CK2Tub[j] = dynamic_cast<G4Tubs*>(logicalCK2Volume->GetSolid());
1085 Z = 0.;
1086 A = 0.;
1087 for(i=0; i<CK2Material->GetElementVector()->size(); i++){
1088 Z += (CK2Material->GetElement(i)->GetZ())*
1089 (CK2Material->GetFractionVector()[i]);
1090 A += (CK2Material->GetElement(i)->GetA())*
1091 (CK2Material->GetFractionVector()[i]);
1092 }
1093 Ionization = CK2Material->GetIonisation()->GetMeanExcitationEnergy();
1094 Density = CK2Material->GetDensity()/(g/cm3);
1095 Radlen = CK2Material->GetRadlen();
1096 cout<<"CK2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1097 KalFitMaterial FitCK2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1098 _BesKalmanFitMaterials.push_back(FitCK2Material);
1099 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1100
1101 ///--- Cathode Epoxy2
1102 ss.str("");
1103 ss << "Cathode_Epoxy2_logic" << j ;
1104 s = ss.str();
1105 G4LogicalVolume* logicalCE2Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1106 G4Material* CE2Material = logicalCE2Volume->GetMaterial();
1107 CE2Tub[j] = dynamic_cast<G4Tubs*>(logicalCE2Volume->GetSolid());
1108 Z = 0.;
1109 A = 0.;
1110 for(i=0; i<CE2Material->GetElementVector()->size(); i++){
1111 Z += (CE2Material->GetElement(i)->GetZ())*
1112 (CE2Material->GetFractionVector()[i]);
1113 A += (CE2Material->GetElement(i)->GetA())*
1114 (CE2Material->GetFractionVector()[i]);
1115 }
1116 Ionization = CE2Material->GetIonisation()->GetMeanExcitationEnergy();
1117 Density = CE2Material->GetDensity()/(g/cm3);
1118 Radlen = CE2Material->GetRadlen();
1119 cout<<"CE2: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1120 KalFitMaterial FitCE2Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1121 _BesKalmanFitMaterials.push_back(FitCE2Material);
1122 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1123
1124 ///--- Cathode Rohacell1
1125 ss.str("");
1126 ss << "Cathode_Rohacell1_logic" << j ;
1127 s = ss.str();
1128 G4LogicalVolume* logicalCR1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1129 G4Material* CR1Material = logicalCR1Volume->GetMaterial();
1130 CR1Tub[j] = dynamic_cast<G4Tubs*>(logicalCR1Volume->GetSolid());
1131 Z = 0.;
1132 A = 0.;
1133 for(i=0; i<CR1Material->GetElementVector()->size(); i++){
1134 Z += (CR1Material->GetElement(i)->GetZ())*
1135 (CR1Material->GetFractionVector()[i]);
1136 A += (CR1Material->GetElement(i)->GetA())*
1137 (CR1Material->GetFractionVector()[i]);
1138 }
1139 Ionization = CR1Material->GetIonisation()->GetMeanExcitationEnergy();
1140 Density = CR1Material->GetDensity()/(g/cm3);
1141 Radlen = CR1Material->GetRadlen();
1142 cout<<"CR1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1143 KalFitMaterial FitCR1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1144 _BesKalmanFitMaterials.push_back(FitCR1Material);
1145 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1146
1147 ///--- Cathode Epoxy1
1148 ss.str("");
1149 ss << "Cathode_Epoxy1_logic" << j ;
1150 s = ss.str();
1151 G4LogicalVolume* logicalCE1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1152 G4Material* CE1Material = logicalCE1Volume->GetMaterial();
1153 CE1Tub[j] = dynamic_cast<G4Tubs*>(logicalCE1Volume->GetSolid());
1154 Z = 0.;
1155 A = 0.;
1156 for(i=0; i<CE1Material->GetElementVector()->size(); i++){
1157 Z += (CE1Material->GetElement(i)->GetZ())*
1158 (CE1Material->GetFractionVector()[i]);
1159 A += (CE1Material->GetElement(i)->GetA())*
1160 (CE1Material->GetFractionVector()[i]);
1161 }
1162 Ionization = CE1Material->GetIonisation()->GetMeanExcitationEnergy();
1163 Density = CE1Material->GetDensity()/(g/cm3);
1164 Radlen = CE1Material->GetRadlen();
1165 cout<<"CE1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1166 KalFitMaterial FitCE1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1167 _BesKalmanFitMaterials.push_back(FitCE1Material);
1168 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1169 /*
1170 ///--- Cathode Honeycomb
1171 ss.str("");
1172 ss << "Cathode_Honeycomb_logic" << j ;
1173 s = ss.str();
1174 G4LogicalVolume* logicalCHVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1175 G4Material* CHMaterial = logicalCHVolume->GetMaterial();
1176 CHTub[j] = dynamic_cast<G4Tubs*>(logicalCHVolume->GetSolid());
1177 Z = 0.;
1178 A = 0.;
1179 for(i=0; i<CHMaterial->GetElementVector()->size(); i++){
1180 Z += (CHMaterial->GetElement(i)->GetZ())*
1181 (CHMaterial->GetFractionVector()[i]);
1182 A += (CHMaterial->GetElement(i)->GetA())*
1183 (CHMaterial->GetFractionVector()[i]);
1184 }
1185 Ionization = CHMaterial->GetIonisation()->GetMeanExcitationEnergy();
1186 Density = CHMaterial->GetDensity()/(g/cm3);
1187 Radlen = CHMaterial->GetRadlen();
1188 cout<<"CH: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1189 KalFitMaterial FitCHMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1190 _BesKalmanFitMaterials.push_back(FitCHMaterial);
1191 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1192 */
1193 ///--- Cathode Kapton1
1194 ss.str("");
1195 ss << "Cathode_Kapton1_logic" << j ;
1196 s = ss.str();
1197 G4LogicalVolume* logicalCK1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1198 G4Material* CK1Material = logicalCK1Volume->GetMaterial();
1199 CK1Tub[j] = dynamic_cast<G4Tubs*>(logicalCK1Volume->GetSolid());
1200 Z = 0.;
1201 A = 0.;
1202 for(i=0; i<CK1Material->GetElementVector()->size(); i++){
1203 Z += (CK1Material->GetElement(i)->GetZ())*
1204 (CK1Material->GetFractionVector()[i]);
1205 A += (CK1Material->GetElement(i)->GetA())*
1206 (CK1Material->GetFractionVector()[i]);
1207 }
1208 Ionization = CK1Material->GetIonisation()->GetMeanExcitationEnergy();
1209 Density = CK1Material->GetDensity()/(g/cm3);
1210 Radlen = CK1Material->GetRadlen();
1211 cout<<"CK1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1212 KalFitMaterial FitCK1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1213 _BesKalmanFitMaterials.push_back(FitCK1Material);
1214 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1215 /*
1216 ///--- Cathode Cu1
1217 ss.str("");
1218 ss << "Cathode_Cu1_logic" << j ;
1219 s = ss.str();
1220 G4LogicalVolume* logicalCC1Volume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1221 G4Material* CC1Material = logicalCC1Volume->GetMaterial();
1222 CC1Tub[j] = dynamic_cast<G4Tubs*>(logicalCC1Volume->GetSolid());
1223 Z = 0.;
1224 A = 0.;
1225 for(i=0; i<CC1Material->GetElementVector()->size(); i++){
1226 Z += (CC1Material->GetElement(i)->GetZ())*
1227 (CC1Material->GetFractionVector()[i]);
1228 A += (CC1Material->GetElement(i)->GetA())*
1229 (CC1Material->GetFractionVector()[i]);
1230 }
1231 Ionization = CC1Material->GetIonisation()->GetMeanExcitationEnergy();
1232 Density = CC1Material->GetDensity()/(g/cm3);
1233 Radlen = CC1Material->GetRadlen();
1234 cout<<"CC1: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1235 KalFitMaterial FitCC1Material(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1236 _BesKalmanFitMaterials.push_back(FitCC1Material);
1237 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1238 */
1239 ///---air
1240 if(j>0){
1241 ss.str("");
1242 ss << "CgemLayer_logic" << j ;
1243// ss << "Cgem_logic" ;
1244 s = ss.str();
1245 G4LogicalVolume* logicalCLayerVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume(s));
1246 G4Material* CLayerMaterial = logicalCLayerVolume->GetMaterial();
1247 Z = 0.;
1248 A = 0.;
1249 for(i=0; i<CLayerMaterial->GetElementVector()->size(); i++){
1250 Z += (CLayerMaterial->GetElement(i)->GetZ())*
1251 (CLayerMaterial->GetFractionVector()[i]);
1252 A += (CLayerMaterial->GetElement(i)->GetA())*
1253 (CLayerMaterial->GetFractionVector()[i]);
1254 }
1255 Ionization = CLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
1256 Density = CLayerMaterial->GetDensity()/(g/cm3);
1257 Radlen = CLayerMaterial->GetRadlen();
1258 cout<<"CLayer: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1259 KalFitMaterial FitCLayerMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1260 _BesKalmanFitMaterials.push_back(FitCLayerMaterial);
1261 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1262 }
1263
1264 }
1265
1266 ///////////////////////////////////////////////////////////////////////////////////////////////////
1267 G4LogicalVolume *logicalBes = 0;
1268 BesG4Geo* aBesG4Geo = new BesG4Geo();
1269 logicalBes = aBesG4Geo->GetTopVolume();
1270
1271 /// air
1272 G4LogicalVolume* logicalAirVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalWorld"));
1273 G4Material* airMaterial = logicalAirVolume->GetMaterial();
1274 Z = 0.;
1275 A = 0.;
1276 for(i=0; i<airMaterial->GetElementVector()->size(); i++){
1277 Z += (airMaterial->GetElement(i)->GetZ())*
1278 (airMaterial->GetFractionVector()[i]);
1279 A += (airMaterial->GetElement(i)->GetA())*
1280 (airMaterial->GetFractionVector()[i]);
1281 }
1282
1283 Ionization = airMaterial->GetIonisation()->GetMeanExcitationEnergy();
1284 Density = airMaterial->GetDensity()/(g/cm3);
1285 Radlen = airMaterial->GetRadlen();
1286 cout<<"air: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1287 KalFitMaterial FitAirMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1288 _BesKalmanFitMaterials.push_back(FitAirMaterial);
1289 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1290
1291 /// outer beryllium pipe
1292 G4LogicalVolume* logicalOuterBeVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalouterBe"));
1293 G4Material* outerBeMaterial = logicalOuterBeVolume->GetMaterial();
1294
1295 G4Tubs* outerBeTub = dynamic_cast<G4Tubs*>(logicalOuterBeVolume->GetSolid());
1296 Z = 0.;
1297 A = 0.;
1298 for(i=0; i<outerBeMaterial->GetElementVector()->size(); i++){
1299 Z += (outerBeMaterial->GetElement(i)->GetZ())*
1300 (outerBeMaterial->GetFractionVector()[i]);
1301 A += (outerBeMaterial->GetElement(i)->GetA())*
1302 (outerBeMaterial->GetFractionVector()[i]);
1303 }
1304 Ionization = outerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
1305 Density = outerBeMaterial->GetDensity()/(g/cm3);
1306 Radlen = outerBeMaterial->GetRadlen();
1307 cout<<"outer beryllium: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1308 KalFitMaterial FitOuterBeMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1309 _BesKalmanFitMaterials.push_back(FitOuterBeMaterial);
1310 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1311
1312
1313 /// cooling oil
1314 G4LogicalVolume* logicalOilLayerVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicaloilLayer"));
1315 G4Material* oilLayerMaterial = logicalOilLayerVolume->GetMaterial();
1316 G4Tubs* oilLayerTub = dynamic_cast<G4Tubs*>(logicalOilLayerVolume->GetSolid());
1317
1318 Z = 0.;
1319 A = 0.;
1320 for(i=0; i<oilLayerMaterial->GetElementVector()->size(); i++){
1321 Z += (oilLayerMaterial->GetElement(i)->GetZ())*
1322 (oilLayerMaterial->GetFractionVector()[i]);
1323 A += (oilLayerMaterial->GetElement(i)->GetA())*
1324 (oilLayerMaterial->GetFractionVector()[i]);
1325 }
1326 Ionization = oilLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
1327 Density = oilLayerMaterial->GetDensity()/(g/cm3);
1328 Radlen = oilLayerMaterial->GetRadlen();
1329 cout<<"cooling oil: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1330 KalFitMaterial FitOilLayerMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1331 _BesKalmanFitMaterials.push_back(FitOilLayerMaterial);
1332 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1333
1334
1335 /// inner beryllium pipe
1336 G4LogicalVolume* logicalInnerBeVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalinnerBe"));
1337 G4Material* innerBeMaterial = logicalInnerBeVolume->GetMaterial();
1338 G4Tubs* innerBeTub = dynamic_cast<G4Tubs*>(logicalInnerBeVolume->GetSolid());
1339 Z = 0.;
1340 A = 0.;
1341 for(i=0; i<innerBeMaterial->GetElementVector()->size(); i++){
1342 Z += (innerBeMaterial->GetElement(i)->GetZ())*
1343 (innerBeMaterial->GetFractionVector()[i]);
1344 A += (innerBeMaterial->GetElement(i)->GetA())*
1345 (innerBeMaterial->GetFractionVector()[i]);
1346 }
1347
1348 Ionization = innerBeMaterial->GetIonisation()->GetMeanExcitationEnergy();
1349 Density = innerBeMaterial->GetDensity()/(g/cm3);
1350 Radlen = innerBeMaterial->GetRadlen();
1351 cout<<"inner beryllium: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1352 KalFitMaterial FitInnerBeMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1353 _BesKalmanFitMaterials.push_back(FitInnerBeMaterial);
1354 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1355
1356
1357 /// gold
1358 G4LogicalVolume* logicalGoldLayerVolume = const_cast<G4LogicalVolume*>(GDMLProcessor::GetInstance()->GetLogicalVolume("logicalgoldLayer"));
1359 G4Material* goldLayerMaterial = logicalGoldLayerVolume->GetMaterial();
1360 G4Tubs* goldLayerTub = dynamic_cast<G4Tubs*>(logicalGoldLayerVolume->GetSolid());
1361
1362 Z = 0.;
1363 A = 0.;
1364 for(i=0; i<goldLayerMaterial->GetElementVector()->size(); i++){
1365 Z += (goldLayerMaterial->GetElement(i)->GetZ())*
1366 (goldLayerMaterial->GetFractionVector()[i]);
1367 A += (goldLayerMaterial->GetElement(i)->GetA())*
1368 (goldLayerMaterial->GetFractionVector()[i]);
1369 }
1370 Ionization = goldLayerMaterial->GetIonisation()->GetMeanExcitationEnergy();
1371 Density = goldLayerMaterial->GetDensity()/(g/cm3);
1372 Radlen = goldLayerMaterial->GetRadlen();
1373 cout<<"gold layer: Z: "<<Z<<" A: "<<(A/(g/mole))<<" Ionization: "<<(Ionization/eV)<<" Density: "<<Density<<" Radlen: "<<Radlen<<endl;
1374 KalFitMaterial FitGoldLayerMaterial(Z,A/g/mole,Ionization/eV,Density,Radlen/10.);
1375 _BesKalmanFitMaterials.push_back(FitGoldLayerMaterial);
1376 cout << "@@@@" << _BesKalmanFitMaterials.size() << endl;
1377
1378
1379 /// now construct the cylinders
1380 double radius, thick, length , z0;
1381 int k=0;
1382
1383 /*
1384 /// film1 of the innerwall of inner drift chamber
1385 radius = innerwallFilm1Tub->GetInnerRadius()/(cm);
1386 thick = innerwallFilm1Tub->GetOuterRadius()/(cm) - innerwallFilm1Tub->GetInnerRadius()/(cm);
1387 length = 2.0*innerwallFilm1Tub->GetZHalfLength()/(cm);
1388 z0 = 0.0;
1389 std::cout<<"innerwallFilm1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1390 KalFitCylinder innerwallFilm1Cylinder(&_BesKalmanFitMaterials[1], radius, thick, length , z0);
1391 _BesKalmanFitWalls.push_back(innerwallFilm1Cylinder);
1392
1393
1394 /// innerwall of inner drift chamber
1395 radius = innerwallTub->GetInnerRadius()/(cm);
1396 thick = innerwallTub->GetOuterRadius()/(cm) - innerwallTub->GetInnerRadius()/(cm);
1397 length = 2.0*innerwallTub->GetZHalfLength()/(cm);
1398 z0 = 0.0;
1399 cout<<"innerwall: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<endl;
1400 KalFitCylinder innerwallCylinder(&_BesKalmanFitMaterials[2], radius, thick, length , z0);
1401 _BesKalmanFitWalls.push_back(innerwallCylinder);
1402
1403 /// film0 of the innerwall of inner drift chamber
1404 radius = innerwallFilm0Tub->GetInnerRadius()/(cm);
1405 thick = innerwallFilm0Tub->GetOuterRadius()/(cm) - innerwallFilm0Tub->GetInnerRadius()/(cm);
1406 length = 2.0*innerwallFilm0Tub->GetZHalfLength()/(cm);
1407 z0 = 0.0;
1408 std::cout<<"innerwallFilm0: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1409 KalFitCylinder innerwallFilm0Cylinder(&_BesKalmanFitMaterials[3], radius, thick, length , z0);
1410 _BesKalmanFitWalls.push_back(innerwallFilm0Cylinder);
1411
1412 */
1413 /// Separator
1414 radius = SeparatorTub->GetInnerRadius()/(cm);
1415 thick = SeparatorTub->GetOuterRadius()/(cm) - SeparatorTub->GetInnerRadius()/(cm);
1416 length = 2.0*SeparatorTub->GetZHalfLength()/(cm);
1417 z0 = 0.0;
1418 std::cout<<"Separator: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1419 KalFitCylinder SeparatorCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1420 _BesKalmanFitWalls.push_back(SeparatorCylinder);
1421 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1422 for(int i=2;i>=0;i--){
1423
1424 /// shield kapton2
1425 /*
1426 radius = SK2Tub[i]->GetInnerRadius()/(cm);
1427 thick = SK2Tub[i]->GetOuterRadius()/(cm) - SK2Tub[i]->GetInnerRadius()/(cm);
1428 length = 2.0*SK2Tub[i]->GetZHalfLength()/(cm);
1429 z0 = 0.0;
1430 std::cout<<"SK2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1431 KalFitCylinder SK2Cylinder(&_BesKalmanFitMaterials[1+i*32], radius, thick, length , z0);
1432 _BesKalmanFitWalls.push_back(SK2Cylinder);
1433 */
1434
1435 /// shield honeycomb
1436 /*
1437 radius = HCTub[i]->GetInnerRadius()/(cm);
1438 thick = HCTub[i]->GetOuterRadius()/(cm) - HCTub[i]->GetInnerRadius()/(cm);
1439 length = 2.0*HCTub[i]->GetZHalfLength()/(cm);
1440 z0 = 0.0;
1441 std::cout<<"HC: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1442 KalFitCylinder HCCylinder(&_BesKalmanFitMaterials[2+i*32], radius, thick, length , z0);
1443 _BesKalmanFitWalls.push_back(HCCylinder);
1444 */
1445
1446 /// shield kapton1
1447 /*
1448 radius = SK1Tub[i]->GetInnerRadius()/(cm);
1449 thick = SK1Tub[i]->GetOuterRadius()/(cm) - SK1Tub[i]->GetInnerRadius()/(cm);
1450 length = 2.0*SK1Tub[i]->GetZHalfLength()/(cm);
1451 z0 = 0.0;
1452 std::cout<<"SK1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1453 KalFitCylinder SK1Cylinder(&_BesKalmanFitMaterials[3+i*32], radius, thick, length , z0);
1454 _BesKalmanFitWalls.push_back(SK1Cylinder);
1455 */
1456
1457 /// Anode Kapton4
1458 radius = AK4Tub[i]->GetInnerRadius()/(cm);
1459 thick = AK4Tub[i]->GetOuterRadius()/(cm) - AK4Tub[i]->GetInnerRadius()/(cm);
1460 length = 2.0*AK4Tub[i]->GetZHalfLength()/(cm);
1461 z0 = 0.0;
1462 std::cout<<"AK4: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1463 KalFitCylinder AK4Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1464 _BesKalmanFitWalls.push_back(AK4Cylinder);
1465 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1466
1467 /// Anode Au2
1468 /*
1469 radius = AA2Tub[i]->GetInnerRadius()/(cm);
1470 thick = AA2Tub[i]->GetOuterRadius()/(cm) - AA2Tub[i]->GetInnerRadius()/(cm);
1471 length = 2.0*AA2Tub[i]->GetZHalfLength()/(cm);
1472 z0 = 0.0;
1473 std::cout<<"AA2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1474 KalFitCylinder AA2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1475 _BesKalmanFitWalls.push_back(AA2Cylinder);
1476 */
1477
1478 /// Anode Cu3
1479 radius = AC3Tub[i]->GetInnerRadius()/(cm);
1480 thick = AC3Tub[i]->GetOuterRadius()/(cm) - AC3Tub[i]->GetInnerRadius()/(cm);
1481 length = 2.0*AC3Tub[i]->GetZHalfLength()/(cm);
1482 z0 = 0.0;
1483 std::cout<<"AC3: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1484 KalFitCylinder AC3Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1485 _BesKalmanFitWalls.push_back(AC3Cylinder);
1486 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1487
1488 /// Anode Epoxy5
1489 radius = AE5Tub[i]->GetInnerRadius()/(cm);
1490 thick = AE5Tub[i]->GetOuterRadius()/(cm) - AE5Tub[i]->GetInnerRadius()/(cm);
1491 length = 2.0*AE5Tub[i]->GetZHalfLength()/(cm);
1492 z0 = 0.0;
1493 std::cout<<"AE5: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1494 KalFitCylinder AE5Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1495 _BesKalmanFitWalls.push_back(AE5Cylinder);
1496 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1497
1498 /// Anode Rohacell2
1499 radius = AR2Tub[i]->GetInnerRadius()/(cm);
1500 thick = AR2Tub[i]->GetOuterRadius()/(cm) - AR2Tub[i]->GetInnerRadius()/(cm);
1501 length = 2.0*AR2Tub[i]->GetZHalfLength()/(cm);
1502 z0 = 0.0;
1503 std::cout<<"AR2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1504 KalFitCylinder AR2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1505 _BesKalmanFitWalls.push_back(AR2Cylinder);
1506 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1507
1508 /// Anode Epoxy4
1509 radius = AE4Tub[i]->GetInnerRadius()/(cm);
1510 thick = AE4Tub[i]->GetOuterRadius()/(cm) - AE4Tub[i]->GetInnerRadius()/(cm);
1511 length = 2.0*AE4Tub[i]->GetZHalfLength()/(cm);
1512 z0 = 0.0;
1513 std::cout<<"AE4: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1514 KalFitCylinder AE4Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1515 _BesKalmanFitWalls.push_back(AE4Cylinder);
1516 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1517
1518 /// Anode Kapton3
1519 radius = AK3Tub[i]->GetInnerRadius()/(cm);
1520 thick = AK3Tub[i]->GetOuterRadius()/(cm) - AK3Tub[i]->GetInnerRadius()/(cm);
1521 length = 2.0*AK3Tub[i]->GetZHalfLength()/(cm);
1522 z0 = 0.0;
1523 std::cout<<"AK3: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1524 KalFitCylinder AK3Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1525 _BesKalmanFitWalls.push_back(AK3Cylinder);
1526 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1527
1528 /// Anode Epoxy3
1529 radius = AE3Tub[i]->GetInnerRadius()/(cm);
1530 thick = AE3Tub[i]->GetOuterRadius()/(cm) - AE3Tub[i]->GetInnerRadius()/(cm);
1531 length = 2.0*AE3Tub[i]->GetZHalfLength()/(cm);
1532 z0 = 0.0;
1533 std::cout<<"AE3: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1534 KalFitCylinder AE3Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1535 _BesKalmanFitWalls.push_back(AE3Cylinder);
1536 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1537
1538 /// Anode Rohacell1
1539 radius = AR1Tub[i]->GetInnerRadius()/(cm);
1540 thick = AR1Tub[i]->GetOuterRadius()/(cm) - AR1Tub[i]->GetInnerRadius()/(cm);
1541 length = 2.0*AR1Tub[i]->GetZHalfLength()/(cm);
1542 z0 = 0.0;
1543 std::cout<<"AR1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1544 KalFitCylinder AR1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1545 _BesKalmanFitWalls.push_back(AR1Cylinder);
1546 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1547
1548 /// Anode Epoxy2
1549 radius = AE2Tub[i]->GetInnerRadius()/(cm);
1550 thick = AE2Tub[i]->GetOuterRadius()/(cm) - AE2Tub[i]->GetInnerRadius()/(cm);
1551 length = 2.0*AE2Tub[i]->GetZHalfLength()/(cm);
1552 z0 = 0.0;
1553 std::cout<<"AE2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1554 KalFitCylinder AE2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1555 _BesKalmanFitWalls.push_back(AE2Cylinder);
1556 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1557
1558 /// Anode Kapton2
1559 radius = AK2Tub[i]->GetInnerRadius()/(cm);
1560 thick = AK2Tub[i]->GetOuterRadius()/(cm) - AK2Tub[i]->GetInnerRadius()/(cm);
1561 length = 2.0*AK2Tub[i]->GetZHalfLength()/(cm);
1562 z0 = 0.0;
1563 std::cout<<"AK2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1564 KalFitCylinder AK2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1565 _BesKalmanFitWalls.push_back(AK2Cylinder);
1566 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1567
1568 /// Anode Epoxy1
1569 radius = AE1Tub[i]->GetInnerRadius()/(cm);
1570 thick = AE1Tub[i]->GetOuterRadius()/(cm) - AE1Tub[i]->GetInnerRadius()/(cm);
1571 length = 2.0*AE1Tub[i]->GetZHalfLength()/(cm);
1572 z0 = 0.0;
1573 std::cout<<"AE1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1574 KalFitCylinder AE1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1575 _BesKalmanFitWalls.push_back(AE1Cylinder);
1576 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1577
1578 /// Anode Cu2
1579 radius = AC2Tub[i]->GetInnerRadius()/(cm);
1580 thick = AC2Tub[i]->GetOuterRadius()/(cm) - AC2Tub[i]->GetInnerRadius()/(cm);
1581 length = 2.0*AC2Tub[i]->GetZHalfLength()/(cm);
1582 z0 = 0.0;
1583 std::cout<<"AC2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1584 KalFitCylinder AC2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1585 _BesKalmanFitWalls.push_back(AC2Cylinder);
1586 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1587
1588 // Anode Kapton1
1589 radius = AK1Tub[i]->GetInnerRadius()/(cm);
1590 thick = AK1Tub[i]->GetOuterRadius()/(cm) - AK1Tub[i]->GetInnerRadius()/(cm);
1591 length = 2.0*AK1Tub[i]->GetZHalfLength()/(cm);
1592 z0 = 0.0;
1593 std::cout<<"AK1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1594 KalFitCylinder AK1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1595 _BesKalmanFitWalls.push_back(AK1Cylinder);
1596 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1597
1598 /// Anode Cu1
1599 radius = AC1Tub[i]->GetInnerRadius()/(cm);
1600 thick = AC1Tub[i]->GetOuterRadius()/(cm) - AC1Tub[i]->GetInnerRadius()/(cm);
1601 length = 2.0*AC1Tub[i]->GetZHalfLength()/(cm);
1602 z0 = 0.0;
1603 std::cout<<"AC1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1604 KalFitCylinder AC1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1605 _BesKalmanFitWalls.push_back(AC1Cylinder);
1606 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1607
1608 /// Anode Au1
1609 /*
1610 radius = AA1Tub[i]->GetInnerRadius()/(cm);
1611 thick = AA1Tub[i]->GetOuterRadius()/(cm) - AA1Tub[i]->GetInnerRadius()/(cm);
1612 length = 2.0*AA1Tub[i]->GetZHalfLength()/(cm);
1613 z0 = 0.0;
1614 std::cout<<"AA1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1615 KalFitCylinder AA1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1616 _BesKalmanFitWalls.push_back(AA1Cylinder);
1617 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1618 */
1619
1620 /// GAP I
1621 radius = GAPITub[i]->GetInnerRadius()/(cm);
1622 thick = GAPITub[i]->GetOuterRadius()/(cm) - GAPITub[i]->GetInnerRadius()/(cm);
1623 length = 2.0*GAPITub[i]->GetZHalfLength()/(cm);
1624 z0 = 0.0;
1625 std::cout<<"GAPI: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1626 KalFitCylinder GAPICylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1627 _BesKalmanFitWalls.push_back(GAPICylinder);
1628 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1629
1630 /// Foil Gem2
1631 /// Cu2
1632 radius = FC22Tub[i]->GetInnerRadius()/(cm);
1633 thick = FC22Tub[i]->GetOuterRadius()/(cm) - FC22Tub[i]->GetInnerRadius()/(cm);
1634 length = 2.0*FC22Tub[i]->GetZHalfLength()/(cm);
1635 z0 = 0.0;
1636 std::cout<<"FC22: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1637 KalFitCylinder FC22Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1638 _BesKalmanFitWalls.push_back(FC22Cylinder);
1639 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1640
1641 /// Kapton
1642 radius = FK2Tub[i]->GetInnerRadius()/(cm);
1643 thick = FK2Tub[i]->GetOuterRadius()/(cm) - FK2Tub[i]->GetInnerRadius()/(cm);
1644 length = 2.0*FK2Tub[i]->GetZHalfLength()/(cm);
1645 z0 = 0.0;
1646 std::cout<<"FK2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1647 KalFitCylinder FK2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1648 _BesKalmanFitWalls.push_back(FK2Cylinder);
1649 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1650
1651 /// Cu1
1652 radius = FC12Tub[i]->GetInnerRadius()/(cm);
1653 thick = FC12Tub[i]->GetOuterRadius()/(cm) - FC12Tub[i]->GetInnerRadius()/(cm);
1654 length = 2.0*FC12Tub[i]->GetZHalfLength()/(cm);
1655 z0 = 0.0;
1656 std::cout<<"FC12: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1657 KalFitCylinder FC12Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1658 _BesKalmanFitWalls.push_back(FC12Cylinder);
1659 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1660
1661 ///Gap T2
1662 radius = GAPT2Tub[i]->GetInnerRadius()/(cm);
1663 thick = GAPT2Tub[i]->GetOuterRadius()/(cm) - GAPT2Tub[i]->GetInnerRadius()/(cm);
1664 length = 2.0*GAPT2Tub[i]->GetZHalfLength()/(cm);
1665 z0 = 0.0;
1666 std::cout<<"GAPT2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1667 KalFitCylinder GAPT2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1668 _BesKalmanFitWalls.push_back(GAPT2Cylinder);
1669 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1670
1671 //Gem Foil1
1672 //Cu2
1673 radius = FC21Tub[i]->GetInnerRadius()/(cm);
1674 thick = FC21Tub[i]->GetOuterRadius()/(cm) - FC21Tub[i]->GetInnerRadius()/(cm);
1675 length = 2.0*FC21Tub[i]->GetZHalfLength()/(cm);
1676 z0 = 0.0;
1677 std::cout<<"FC21: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1678 KalFitCylinder FC21Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1679 _BesKalmanFitWalls.push_back(FC21Cylinder);
1680 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1681
1682 // Kapton
1683 radius = FK1Tub[i]->GetInnerRadius()/(cm);
1684 thick = FK1Tub[i]->GetOuterRadius()/(cm) - FK1Tub[i]->GetInnerRadius()/(cm);
1685 length = 2.0*FK1Tub[i]->GetZHalfLength()/(cm);
1686 z0 = 0.0;
1687 std::cout<<"FK1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1688 KalFitCylinder FK1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1689 _BesKalmanFitWalls.push_back(FK1Cylinder);
1690 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1691
1692 // Cu1
1693 radius = FC11Tub[i]->GetInnerRadius()/(cm);
1694 thick = FC11Tub[i]->GetOuterRadius()/(cm) - FC11Tub[i]->GetInnerRadius()/(cm);
1695 length = 2.0*FC11Tub[i]->GetZHalfLength()/(cm);
1696 z0 = 0.0;
1697 std::cout<<"FC11: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1698 KalFitCylinder FC11Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1699 _BesKalmanFitWalls.push_back(FC11Cylinder);
1700 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1701
1702 // Gap T1
1703 radius = GAPT1Tub[i]->GetInnerRadius()/(cm);
1704 thick = GAPT1Tub[i]->GetOuterRadius()/(cm) - GAPT1Tub[i]->GetInnerRadius()/(cm);
1705 length = 2.0*GAPT1Tub[i]->GetZHalfLength()/(cm);
1706 z0 = 0.0;
1707 std::cout<<"GAPT1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1708 KalFitCylinder GAPT1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1709 _BesKalmanFitWalls.push_back(GAPT1Cylinder);
1710 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1711
1712 // Gem Foil0
1713 // Cu2
1714 radius = FC20Tub[i]->GetInnerRadius()/(cm);
1715 thick = FC20Tub[i]->GetOuterRadius()/(cm) - FC20Tub[i]->GetInnerRadius()/(cm);
1716 length = 2.0*FC20Tub[i]->GetZHalfLength()/(cm);
1717 z0 = 0.0;
1718 std::cout<<"FC20: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1719 KalFitCylinder FC20Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1720 _BesKalmanFitWalls.push_back(FC20Cylinder);
1721 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1722
1723 // Kapton
1724 radius = FK0Tub[i]->GetInnerRadius()/(cm);
1725 thick = FK0Tub[i]->GetOuterRadius()/(cm) - FK0Tub[i]->GetInnerRadius()/(cm);
1726 length = 2.0*FK0Tub[i]->GetZHalfLength()/(cm);
1727 z0 = 0.0;
1728 std::cout<<"FK0: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1729 KalFitCylinder FK0Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1730 _BesKalmanFitWalls.push_back(FK0Cylinder);
1731 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1732
1733 // Cu1
1734 radius = FC10Tub[i]->GetInnerRadius()/(cm);
1735 //thick = 0.0002;//FC10Tub[i]->GetOuterRadius()/(cm) - FC10Tub[i]->GetInnerRadius()/(cm);
1736 thick = FC10Tub[i]->GetOuterRadius()/(cm) - FC10Tub[i]->GetInnerRadius()/(cm);
1737 length = 2.0*FC10Tub[i]->GetZHalfLength()/(cm);
1738 z0 = 0.0;
1739 std::cout<<"FC10: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1740 KalFitCylinder FC10Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1741 _BesKalmanFitWalls.push_back(FC10Cylinder);
1742 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1743
1744 // Gap D
1745 radius = GAPDTub[i]->GetInnerRadius()/(cm);
1746 thick = GAPDTub[i]->GetOuterRadius()/(cm) - GAPDTub[i]->GetInnerRadius()/(cm);
1747 length = 2.0*GAPDTub[i]->GetZHalfLength()/(cm);
1748 z0 = 0.0;
1749 std::cout<<"GAPD: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1750 KalFitCylinder GAPDCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1751 _BesKalmanFitWalls.push_back(GAPDCylinder);
1752 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1753
1754 // Cathode Cu
1755 radius = CCuTub[i]->GetInnerRadius()/(cm);
1756 thick = CCuTub[i]->GetOuterRadius()/(cm) - CCuTub[i]->GetInnerRadius()/(cm);
1757 length = 2.0*CCuTub[i]->GetZHalfLength()/(cm);
1758 z0 = 0.0;
1759 std::cout<<"CCu: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1760 KalFitCylinder CCuCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1761 _BesKalmanFitWalls.push_back(CCuCylinder);
1762 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1763
1764 // Cathode Kapton3
1765 radius = CK3Tub[i]->GetInnerRadius()/(cm);
1766 thick = CK3Tub[i]->GetOuterRadius()/(cm) - CK3Tub[i]->GetInnerRadius()/(cm);
1767 length = 2.0*CK3Tub[i]->GetZHalfLength()/(cm);
1768 z0 = 0.0;
1769 std::cout<<"CK3: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1770 KalFitCylinder CK3Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1771 _BesKalmanFitWalls.push_back(CK3Cylinder);
1772 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1773
1774 // Cathode Epoxy4
1775 radius = CE4Tub[i]->GetInnerRadius()/(cm);
1776 thick = CE4Tub[i]->GetOuterRadius()/(cm) - CE4Tub[i]->GetInnerRadius()/(cm);
1777 length = 2.0*CE4Tub[i]->GetZHalfLength()/(cm);
1778 z0 = 0.0;
1779 std::cout<<"CE4: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1780 KalFitCylinder CE4Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1781 _BesKalmanFitWalls.push_back(CE4Cylinder);
1782 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1783
1784 // Cathode Rohacell2
1785 radius = CR2Tub[i]->GetInnerRadius()/(cm);
1786 thick = CR2Tub[i]->GetOuterRadius()/(cm) - CR2Tub[i]->GetInnerRadius()/(cm);
1787 length = 2.0*CR2Tub[i]->GetZHalfLength()/(cm);
1788 z0 = 0.0;
1789 std::cout<<"CR2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1790 KalFitCylinder CR2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1791 _BesKalmanFitWalls.push_back(CR2Cylinder);
1792 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1793
1794 // Cathode Epoxy3
1795 radius = CE3Tub[i]->GetInnerRadius()/(cm);
1796 thick = CE3Tub[i]->GetOuterRadius()/(cm) - CE3Tub[i]->GetInnerRadius()/(cm);
1797 length = 2.0*CE3Tub[i]->GetZHalfLength()/(cm);
1798 z0 = 0.0;
1799 std::cout<<"CE3: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1800 KalFitCylinder CE3Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1801 _BesKalmanFitWalls.push_back(CE3Cylinder);
1802 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1803
1804 // Cathode Kapton2
1805 radius = CK2Tub[i]->GetInnerRadius()/(cm);
1806 thick = CK2Tub[i]->GetOuterRadius()/(cm) - CK2Tub[i]->GetInnerRadius()/(cm);
1807 length = 2.0*CK2Tub[i]->GetZHalfLength()/(cm);
1808 z0 = 0.0;
1809 std::cout<<"CK2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1810 KalFitCylinder CK2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1811 _BesKalmanFitWalls.push_back(CK2Cylinder);
1812 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1813
1814 // Cathode Epoxy2
1815 radius = CE2Tub[i]->GetInnerRadius()/(cm);
1816 thick = CE2Tub[i]->GetOuterRadius()/(cm) - CE2Tub[i]->GetInnerRadius()/(cm);
1817 length = 2.0*CE2Tub[i]->GetZHalfLength()/(cm);
1818 z0 = 0.0;
1819 std::cout<<"CE2: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1820 KalFitCylinder CE2Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1821 _BesKalmanFitWalls.push_back(CE2Cylinder);
1822 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1823
1824 // Cathode Rohacell1
1825 radius = CR1Tub[i]->GetInnerRadius()/(cm);
1826 thick = CR1Tub[i]->GetOuterRadius()/(cm) - CR1Tub[i]->GetInnerRadius()/(cm);
1827 length = 2.0*CR1Tub[i]->GetZHalfLength()/(cm);
1828 z0 = 0.0;
1829 std::cout<<"CR1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1830 KalFitCylinder CR1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1831 _BesKalmanFitWalls.push_back(CR1Cylinder);
1832 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1833
1834 // Cathode Epoxy1
1835 radius = CE1Tub[i]->GetInnerRadius()/(cm);
1836 thick = CE1Tub[i]->GetOuterRadius()/(cm) - CE1Tub[i]->GetInnerRadius()/(cm);
1837 length = 2.0*CE1Tub[i]->GetZHalfLength()/(cm);
1838 z0 = 0.0;
1839 std::cout<<"CE1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1840 KalFitCylinder CE1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1841 _BesKalmanFitWalls.push_back(CE1Cylinder);
1842 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1843
1844 //Cathode Honeycomb
1845 /*
1846 radius = CHTub[i]->GetInnerRadius()/(cm);
1847 thick = CHTub[i]->GetOuterRadius()/(cm) - CHTub[i]->GetInnerRadius()/(cm);
1848 length = 2.0*CHTub[i]->GetZHalfLength()/(cm);
1849 z0 = 0.0;
1850 std::cout<<"CH: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1851 KalFitCylinder CHCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1852 _BesKalmanFitWalls.push_back(CHCylinder);
1853 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1854 */
1855
1856 //Cathode Kapton1
1857 radius = CK1Tub[i]->GetInnerRadius()/(cm);
1858 thick = CK1Tub[i]->GetOuterRadius()/(cm) - CK1Tub[i]->GetInnerRadius()/(cm);
1859 length = 2.0*CK1Tub[i]->GetZHalfLength()/(cm);
1860 z0 = 0.0;
1861 std::cout<<"CK1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1862 KalFitCylinder CK1Cylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1863 _BesKalmanFitWalls.push_back(CK1Cylinder);
1864 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1865
1866 // Cathode Cu1
1867 /*
1868 radius = CC1Tub[i]->GetInnerRadius()/(cm);
1869 thick = CC1Tub[i]->GetOuterRadius()/(cm) - CC1Tub[i]->GetInnerRadius()/(cm);
1870 length = 2.0*CC1Tub[i]->GetZHalfLength()/(cm);
1871 z0 = 0.0;
1872 std::cout<<"CC1: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1873 KalFitCylinder CC1Cylinder(&_BesKalmanFitMaterials[31+i*32], radius, thick, length , z0);
1874 _BesKalmanFitWalls.push_back(CC1Cylinder);
1875 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1876 */
1877
1878 //air between different CgemLayer
1879 if(i>=1){
1880 radius = AK4Tub[i-1]->GetOuterRadius()/(cm);
1881 thick = CK1Tub[i]->GetInnerRadius()/(cm) - AK4Tub[i-1]->GetOuterRadius()/(cm);
1882 length = 2.0*CK1Tub[i]->GetZHalfLength()/(cm);
1883 z0 = 0.0;
1884 std::cout<<"air between layer: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<std::endl;
1885 KalFitCylinder AirBCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1886 _BesKalmanFitWalls.push_back(AirBCylinder);
1887 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1888 }
1889 }
1890
1891 /// outer air, be attention the calculation of the radius and thick of the air cylinder is special
1892 radius = outerBeTub->GetOuterRadius()/(cm);
1893 thick = CK1Tub[0]->GetInnerRadius()/(cm) - outerBeTub->GetOuterRadius()/(cm);
1894 length = 2.0*CK1Tub[0]->GetZHalfLength()/(cm);
1895 z0 = 0.0;
1896 cout<<"outer air: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<endl;
1897 KalFitCylinder outerAirCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1898 _BesKalmanFitWalls.push_back(outerAirCylinder);
1899 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1900
1901 /// outer Beryllium layer
1902 radius = outerBeTub->GetInnerRadius()/(cm);
1903 thick = outerBeTub->GetOuterRadius()/(cm) - outerBeTub->GetInnerRadius()/(cm);
1904 length = 2.0*outerBeTub->GetZHalfLength()/(cm);
1905 z0 = 0.0;
1906 cout<<"outer Be: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<endl;
1907 KalFitCylinder outerBeCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1908 _BesKalmanFitWalls.push_back(outerBeCylinder);
1909 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1910
1911 /// oil layer
1912 radius = oilLayerTub->GetInnerRadius()/(cm);
1913 thick = oilLayerTub->GetOuterRadius()/(cm) - oilLayerTub->GetInnerRadius()/(cm);
1914 length = 2.0*oilLayerTub->GetZHalfLength()/(cm);
1915 z0 = 0.0;
1916 cout<<"oil layer: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<endl;
1917 KalFitCylinder oilLayerCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1918 _BesKalmanFitWalls.push_back(oilLayerCylinder);
1919 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1920
1921 /// inner Beryllium layer
1922 radius = innerBeTub->GetInnerRadius()/(cm);
1923 thick = innerBeTub->GetOuterRadius()/(cm) - innerBeTub->GetInnerRadius()/(cm);
1924 length = 2.0*innerBeTub->GetZHalfLength()/(cm);
1925 z0 = 0.0;
1926 cout<<"inner Be: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<endl;
1927 KalFitCylinder innerBeCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1928 _BesKalmanFitWalls.push_back(innerBeCylinder);
1929 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1930
1931 /// gold layer
1932 radius = goldLayerTub->GetInnerRadius()/(cm);
1933 thick = goldLayerTub->GetOuterRadius()/(cm) - goldLayerTub->GetInnerRadius()/(cm);
1934 length = 2.0*goldLayerTub->GetZHalfLength()/(cm);
1935 z0 = 0.0;
1936 cout<<"gold layer: "<<" radius: "<<radius<<" thick:"<<thick<<" length: "<<length<<endl;
1937 KalFitCylinder goldLayerCylinder(&_BesKalmanFitMaterials[++k], radius, thick, length , z0);
1938 _BesKalmanFitWalls.push_back(goldLayerCylinder);
1939 cout<<"wall: "<<k<<" Z: "<<_BesKalmanFitMaterials[k].Z()<<endl;
1940
1941
1942 // --- GEM
1943 //double rGem[4]={7.7,10.7,13.7,16.7}; //cm
1944 //double LGem[4]={774,798,828,858};//cm
1945 //radius=
1946 //_BesGemWalls.push_back();
1947}//end of setBesFromGdml
XmlRpcServer s
Definition: HelloServer.cpp:11
Cylinder is an Element whose shape is a cylinder.
G4LogicalVolume * GetTopVolume()
Get the top(world) volume;.

Referenced by initialize().

◆ setBesFromGdml() [2/2]

void KalFitAlg::setBesFromGdml ( void  )

◆ setCalibSvc_init() [1/2]

void KalFitAlg::setCalibSvc_init ( void  )

initialize for the services

Definition at line 247 of file KalFitAlg2.cxx.

248 {
249 IMdcCalibFunSvc* imdcCalibSvc;
250 MsgStream log(msgSvc(), name());
251 StatusCode sc = service ("MdcCalibFunSvc", imdcCalibSvc);
252 m_mdcCalibFunSvc_ = dynamic_cast<MdcCalibFunSvc*>(imdcCalibSvc);
253 if ( sc.isFailure() ){
254 log << MSG::FATAL << "Could not load MdcCalibFunSvc!" << endreq;
255 }
256 KalFitTrack::setMdcCalibFunSvc( m_mdcCalibFunSvc_);
257 }
static void setMdcCalibFunSvc(const MdcCalibFunSvc *calibsvc)

Referenced by initialize().

◆ setCalibSvc_init() [2/2]

void KalFitAlg::setCalibSvc_init ( void  )

initialize for the services

◆ setCylinder_Mdc() [1/2]

void KalFitAlg::setCylinder_Mdc ( void  )

Initialize the cylinders (walls and cathodes) for Mdc.

◆ setCylinder_Mdc() [2/2]

void KalFitAlg::setCylinder_Mdc ( void  )

Initialize the cylinders (walls and cathodes) for Mdc.

◆ setDchisqCut() [1/2]

void KalFitAlg::setDchisqCut ( void  )

set dchi2cutf_anal

set dchi2cuts_anal

temporary

set dchi2cutf_calib

temporary

set dchi2cuts_calib

temporary

Definition at line 658 of file KalFitAlg.cxx.

659{
660 int layid = 0;
661
662 /// set dchi2cutf_anal
663 for(layid = 0; layid<2; layid++) {
665 }
668 for(layid = 4; layid<12; layid++) {
670 }
671 for(layid = 12; layid<20; layid++) {
673 }
674 for(layid = 20; layid<43; layid++) {
676 }
677
678
679 /// set dchi2cuts_anal
680 for(layid = 0; layid<2; layid++) {
682 }
683
686 for(layid = 4; layid<12; layid++) {
688 }
689 for(layid = 12; layid<20; layid++) {
691 }
692 for(layid = 20; layid<43; layid++) {
694 }
695
696 /// temporary
697 // for(layid = 0; layid<43; layid++) {
698 // KalFitTrack::dchi2cuts_anal[layid] = 10.0;
699 // }
700
701
702 /// set dchi2cutf_calib
703 for(layid = 0; layid<2; layid++) {
705 }
706
709
710 for(layid = 4; layid<12; layid++) {
712 }
713
714 for(layid = 12; layid<20; layid++) {
716 }
717
718 for(layid = 20; layid<43; layid++) {
720 }
721
722 /// temporary
723 if(usage_<2){
724 for(layid = 0; layid<43; layid++) {
725 KalFitTrack::dchi2cutf_calib[layid] = 10.0;
726 }
727 }
728
729
730 /// set dchi2cuts_calib
731 for(layid = 0; layid<2; layid++) {
733 }
734
737
738 for(layid = 4; layid<12; layid++) {
740 }
741
742 for(layid = 12; layid<20; layid++) {
744 }
745
746 for(layid = 20; layid<43; layid++) {
748 }
749
750 /// temporary
751 if(usage_<2){
752 for(layid = 0; layid<43; layid++) {
753 KalFitTrack::dchi2cuts_calib[layid] = 10.0;
754 }
755 }
756}

Referenced by initialize().

◆ setDchisqCut() [2/2]

void KalFitAlg::setDchisqCut ( void  )

◆ setGeomSvc_init() [1/2]

void KalFitAlg::setGeomSvc_init ( void  )

Definition at line 259 of file KalFitAlg2.cxx.

260 {
261 IMdcGeomSvc* imdcGeomSvc;
262 MsgStream log(msgSvc(), name());
263 StatusCode sc = service ("MdcGeomSvc", imdcGeomSvc);
264// m_mdcGeomSvc_ = dynamic_cast<MdcGeomSvc*>(imdcGeomSvc);
265 if ( sc.isFailure() ){
266 log << MSG::FATAL << "Could not load MdcGeomSvc!" << endreq;
267 }
268 imdcGeomSvc_ = imdcGeomSvc;
269
270 KalFitTrack::setIMdcGeomSvc( imdcGeomSvc);
271 }
static void setIMdcGeomSvc(IMdcGeomSvc *igeomsvc)

Referenced by beginRun().

◆ setGeomSvc_init() [2/2]

void KalFitAlg::setGeomSvc_init ( void  )

◆ setMagneticFieldSvc_init() [1/2]

void KalFitAlg::setMagneticFieldSvc_init ( void  )

◆ setMagneticFieldSvc_init() [2/2]

void KalFitAlg::setMagneticFieldSvc_init ( void  )

◆ setMaterial_Mdc() [1/2]

void KalFitAlg::setMaterial_Mdc ( void  )

Initialize the material for Mdc.

◆ setMaterial_Mdc() [2/2]

void KalFitAlg::setMaterial_Mdc ( void  )

Initialize the material for Mdc.

◆ smoother_anal() [1/2]

void KalFitAlg::smoother_anal ( KalFitTrack trk,
int  way 
)

Kalman filter (smoothing or backward part)

be attention to this inital error matrix of smoother, how is track.Ea() in the next sentence when use it?

oh, to be the last hit

calculate the lsat point in MDC

calculate fiTerm

for protection purpose

Definition at line 2450 of file KalFitAlg.cxx.

2451{
2452 // retrieve Mdc geometry information
2453 IMdcGeomSvc* igeomsvc;
2454 StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
2455 if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl;
2456 MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
2457 if(!geomsvc){
2458 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
2459 }
2460
2461 HepPoint3D ip(0,0,0);
2462 if(m_usevtxdb==1){
2463 Hep3Vector xorigin(0,0,0);
2464 IVertexDbSvc* vtxsvc;
2465 Gaudi::svcLocator()->service("VertexDbSvc", vtxsvc);
2466 if(vtxsvc->isVertexValid()){
2467 double* dbv = vtxsvc->PrimaryVertex();
2468 double* vv = vtxsvc->SigmaPrimaryVertex();
2469 xorigin.setX(dbv[0]);
2470 xorigin.setY(dbv[1]);
2471 xorigin.setZ(dbv[2]);
2472 }
2473 ip[0] = xorigin[0];
2474 ip[1] = xorigin[1];
2475 ip[2] = xorigin[2];
2476 }
2477
2478 // Estimation of the path length from ip to 1st cylinder
2479
2480 Helix work = *(Helix*)&track;
2481 work.ignoreErrorMatrix();
2482 work.pivot(ip);
2483
2484
2485 double tanl = track.tanl();
2486 double phi_old = work.phi0();
2487 double phi = track.phi0();
2488
2489 if (fabs(phi - phi_old) > M_PI) {
2490 if (phi > phi_old) phi -= 2 * M_PI;
2491 else phi_old -= 2 * M_PI;
2492 }
2493
2494 double path_zero = fabs(track.radius() * (phi_old-phi)* sqrt(1 + tanl * tanl));
2495 // track.addPathSM(path_zero);
2496
2497
2498 HepSymMatrix Eakal(5,0);
2499 track.pivot(ip);
2500 /// be attention to this inital error matrix of smoother,
2501 /// how is track.Ea() in the next sentence when use it?
2502 Eakal = track.Ea()*matrixg_;
2503 track.Ea(Eakal);
2504
2505 // Mdc part :
2506 unsigned int nhit = track.HitsMdc().size();
2507 int layer_prev = -1;
2508
2509 HepVector pos_old(3,0);
2510 double r0kal_prec(0);
2511 int nhits_read(0);
2512 for( unsigned i=0 ; i < nhit; i++ ) {
2513 int ihit = (nhit-1)-i;
2514 KalFitHitMdc& HitMdc = track.HitMdc(ihit);
2515 const KalFitWire& Wire = HitMdc.wire();
2516
2517 int wireid = Wire.geoID();
2518 nhits_read++;
2519
2520 int layer = Wire.layer().layerId();
2521 if (pathl_ && layer != layer_prev) {
2522
2523 if (debug_ == 4) cout<<"in smoother,layerid "<<layer<<" layer_prev "
2524 <<layer_prev <<" pathl_ "<<pathl_<<endl;
2525
2526 // track.PathL(Wire.layer().layerId());
2527 layer_prev = layer;
2528 }
2529
2530 HepPoint3D fwd(Wire.fwd());
2531 HepPoint3D bck(Wire.bck());
2532 Hep3Vector wire = (CLHEP::Hep3Vector)fwd - (CLHEP::Hep3Vector)bck;
2533 Helix work = *(Helix*)&track;
2534 work.ignoreErrorMatrix();
2535 work.pivot((fwd + bck) * .5);
2536 HepPoint3D x0kal = (work.x(0).z() - bck.z()) / wire.z() * wire + bck;
2537
2538 if(4 == debug_) std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
2539 if (wsag_ == 4){
2540 Hep3Vector result;
2541 const MdcGeoWire* geowire = geomsvc->Wire(wireid);
2542 double tension = geowire->Tension();
2543
2544 //std::cout<<" tension: "<<tension<<std::endl;
2545 double zinit(x0kal.z()), lzx(Wire.lzx());
2546
2547 // double A(Wire.Acoef());
2548 double A = 47.35E-6/tension;
2549 double Zp = (zinit - bck.z())*lzx/wire.z();
2550
2551 if(4 == debug_){
2552 std::cout<<" sag in smoother_anal: "<<std::endl;
2553 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
2554 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
2555 <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;
2556 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
2557 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
2558 <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
2559 }
2560
2561 result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
2562 result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
2563 result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
2564
2565 wire.setX(wire.x()/wire.z());
2566 wire.setY(result.z());
2567 wire.setZ(1);
2568
2569 x0kal.setX(result.x());
2570 x0kal.setY(result.y());
2571 }
2572
2573 if(4 == debug_) std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
2574
2575 // If x0kal is after the inner wall and x0kal_prec before :
2576 double r0kal = x0kal.perp();
2577 if (debug_ == 4) {
2578 cout<<"wire direction "<<wire<<endl;
2579 cout<<"x0kal "<<x0kal<<endl;
2580 cout<<"smoother::r0kal "<<r0kal<<" r0kal_prec "<<r0kal_prec <<endl;
2581 }
2582
2583 // change PIVOT :
2584 /*cout<<endl<<"before change pivot: "<<endl;//wangll
2585 cout<<"track.pivot = "<<track.pivot()<<endl;//wangll
2586 cout<<"track.helix = "<<track.a()<<endl;//wangll
2587 */
2588 double pathl(0);
2589 track.pivot_numf(x0kal, pathl);
2590 track.addPathSM(pathl);
2591 /*cout<<endl<<"after change pivot: "<<endl;//wangll
2592 cout<<"track.pivot = "<<track.pivot()<<endl;//wangll
2593 cout<<"track.helix = "<<track.a()<<endl;//wangll
2594 */
2595
2596 // calculate the tof time in this layer
2597 double pmag( sqrt( 1.0 + track.a()[4]*track.a()[4]) / track.a()[2]);
2598 double mass_over_p( track.mass()/ pmag );
2599 double beta( 1.0 / sqrt( 1.0 + mass_over_p * mass_over_p ) );
2600 double tofest = pathl / ( 29.9792458 * beta );
2601 track.addTofSM(tofest);
2602
2603 // std::cout<<" in layer: "<<layer<<" pathl: "<<pathl<<" tof: "<<tofest<<std::endl;
2604
2605 if(KalFitElement::muls()) track.msgasmdc(pathl, way);
2606 /*cout<<endl<<"after muls: "<<endl;//wangll
2607 cout<<"track.pivot = "<<track.pivot()<<endl;//wangll
2608 cout<<"track.helix = "<<track.a()<<endl;//wangll
2609 */
2610 if(!(way<0&&fabs(track.kappa())>1000.0)) {
2611 if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
2612 }
2613
2614
2615 // Add info hit wire :
2616 /*cout<<endl<<"after eloss: "<<endl;//wangll
2617 cout<<"track.pivot = "<<track.pivot()<<endl;//wangll
2618 cout<<"track.helix = "<<track.a()<<endl;//wangll
2619 */
2620 if(fabs(track.kappa())>0&&fabs(track.kappa())<1000.0&&fabs(track.tanl())<7.02) {
2621 HepVector Va(5,0);
2622 HepSymMatrix Ma(5,0);
2623 KalFitHelixSeg HelixSeg(&HitMdc,x0kal,Va,Ma);
2624
2625 Hep3Vector meas = track.momentum(0).cross(wire).unit();
2626 double dchi2=-1;
2627 track.smoother_Mdc(HitMdc, meas, HelixSeg, dchi2, m_csmflag);
2628 if(dchi2>0.0) {
2629 track.HelixSegs().push_back(HelixSeg);
2630 }
2631 }
2632
2633 /// oh, to be the last hit
2634
2635 if(i == nhit-1){
2636
2637 /// calculate the lsat point in MDC
2638 HepPoint3D point;
2639 point.setX(x0kal.x() + track.a()[0]*cos(track.a()[1]));
2640 point.setY(x0kal.y() + track.a()[0]*sin(track.a()[1]));
2641 point.setZ(x0kal.z() + track.a()[3]);
2642 track.point_last(point);
2643
2644 /// calculate fiTerm
2645 double phi_old = track.a()[1];
2646 KalFitTrack temp(x0kal, track.a(), track.Ea(), 0, 0, 0);
2647 temp.pivot(ip);
2648 double phi_new = temp.a()[1];
2649 double fi = phi_new - phi_old;
2650 /// for protection purpose
2651 //if(fabs(fi) >= CLHEP::twopi) fi = fmod(fi+2*CLHEP::twopi,CLHEP::twopi);
2652
2653 if(fabs(fi) >= CLHEP::twopi) fi = fmod(fi+2*CLHEP::twopi,CLHEP::twopi);
2654
2655 track.fiTerm(fi);
2656 }
2657
2658 if (debug_) cout<<"track----7-----"<<track.a()<<endl;
2659 r0kal_prec = r0kal;
2660 }
2661}
virtual bool isVertexValid()=0
virtual double * SigmaPrimaryVertex()=0
virtual double * PrimaryVertex()=0

Referenced by complete_track().

◆ smoother_anal() [2/2]

void KalFitAlg::smoother_anal ( KalFitTrack trk,
int  way 
)

Kalman filter (smoothing or backward part)

◆ smoother_calib() [1/2]

void KalFitAlg::smoother_calib ( KalFitTrack trk,
int  way 
)

Definition at line 2665 of file KalFitAlg.cxx.

2666{
2667
2668 // retrieve Mdc geometry information
2669 IMdcGeomSvc* igeomsvc;
2670 StatusCode sc = Gaudi::svcLocator()->service("MdcGeomSvc", igeomsvc);
2671 if(sc==StatusCode::FAILURE) cout << "GeoSvc failing!!!!!!!SC=" << sc << endl;
2672 MdcGeomSvc* geomsvc = dynamic_cast<MdcGeomSvc*>(igeomsvc);
2673 if(!geomsvc){
2674 std::cout<<"ERROR OCCUR when dynamic_cast in KalFitTrack.cxx !!"<<std::endl;
2675 }
2676
2677 HepSymMatrix Eakal(5,0);
2678 // Estimation of the path length from ip to 1st cylinder
2679 HepPoint3D ip(0,0,0);
2680 track.pivot(ip);
2681 Eakal = track.getInitMatrix();
2682 if( debug_ == 4) {
2683 std::cout<<"the initial error matrix in smoothing is "<<Eakal<<std::endl;
2684 }
2685 track.Ea(Eakal);
2686
2687 // Mdc part :
2688 unsigned int nseg = track.HelixSegs().size();
2689 int layer_prev = -1;
2690
2691 HepVector pos_old(3,0);
2692 double r0kal_prec(0);
2693 int nsegs_read(0);
2694 for( unsigned i=0 ; i < nseg; i++ ) {
2695
2696 int flag=0;
2697 int iseg = (nseg-1)-i;
2698 KalFitHelixSeg& HelixSeg = track.HelixSeg(iseg);
2699 const KalFitWire& Wire = HelixSeg.HitMdc()->wire();
2700
2701 int wireid = Wire.geoID();
2702 nsegs_read++;
2703
2704 int layer = Wire.layer().layerId();
2705 if (pathl_ && layer != layer_prev) {
2706
2707 if (debug_ == 4) cout<<"in smoother,layerid "<<layer<<" layer_prev "
2708 <<layer_prev <<" pathl_ "<<pathl_<<endl;
2709
2710 // track.PathL(Wire.layer().layerId());
2711 layer_prev = layer;
2712 }
2713
2714 HepPoint3D fwd(Wire.fwd());
2715 HepPoint3D bck(Wire.bck());
2716 Hep3Vector wire = (CLHEP::Hep3Vector)fwd -(CLHEP::Hep3Vector)bck;
2717 Helix work = *(Helix*)&track;
2718 work.ignoreErrorMatrix();
2719 work.pivot((fwd + bck) * .5);
2720 HepPoint3D x0kal = (work.x(0).z() - bck.z()) / wire.z() * wire + bck;
2721
2722
2723 if(4 == debug_) std::cout<<" x0kal before sag: "<<x0kal<<std::endl;
2724
2725 if (wsag_ == 4){
2726
2727 Hep3Vector result;
2728 const MdcGeoWire* geowire = geomsvc->Wire(wireid);
2729 double tension = geowire->Tension();
2730
2731 //std::cout<<" tension: "<<tension<<std::endl;
2732 double zinit(x0kal.z()), lzx(Wire.lzx());
2733
2734 // double A(Wire.Acoef());
2735
2736 double A = 47.35E-6/tension;
2737 double Zp = (zinit - bck.z())*lzx/wire.z();
2738
2739 if(4 == debug_){
2740
2741 std::cout<<" sag in smoother_calib: "<<std::endl;
2742 std::cout<<" x0kal.x(): "<<std::setprecision(10)<<x0kal.x()<<std::endl;
2743 std::cout<<" wire.x()*(zinit-bck.z())/wire.z(): "<<std::setprecision(10)
2744 <<(wire.x()*(zinit-bck.z())/wire.z())<<std::endl;
2745 std::cout<<"bck.x(): "<<std::setprecision(10)<<bck.x()<<std::endl;
2746 std::cout<<" wire.x()*(zinit-bck.z())/wire.z() + bck.x(): "<<std::setprecision(10)
2747 <<(wire.x()*(zinit-bck.z())/wire.z() + bck.x())<<std::endl;
2748 }
2749
2750 result.setX(wire.x()*(zinit-bck.z())/wire.z() + bck.x());
2751 result.setY((A*(Zp-lzx)+wire.y()/lzx)*Zp+bck.y());
2752 result.setZ((A*(2*Zp-lzx)*lzx+wire.y())/wire.z());
2753
2754 wire.setX(wire.x()/wire.z());
2755 wire.setY(result.z());
2756 wire.setZ(1);
2757
2758 x0kal.setX(result.x());
2759 x0kal.setY(result.y());
2760 }
2761
2762 if(4 == debug_) std::cout<<" x0kal after sag: "<<x0kal<<std::endl;
2763
2764
2765 // If x0kal is after the inner wall and x0kal_prec before :
2766 double r0kal = x0kal.perp();
2767 if (debug_ == 4) {
2768 cout<<"wire direction "<<wire<<endl;
2769 cout<<"x0kal "<<x0kal<<endl;
2770 cout<<"smoother::r0kal "<<r0kal<<" r0kal_prec "<<r0kal_prec <<endl;
2771 }
2772
2773 // change PIVOT :
2774 double pathl(0);
2775 track.pivot_numf(x0kal, pathl);
2776
2777 if (debug_ == 4) cout<<"track----6-----"<<track.a()<<" ...path..."<<pathl
2778 <<"momentum"<<track.momentum(0)<<endl;
2779 if(KalFitElement::muls()) track.msgasmdc(pathl, way);
2780 if(KalFitElement::loss()) track.eloss(pathl, _BesKalmanFitMaterials[0], way);
2781
2782 // Add info hit wire :
2783 if(fabs(track.kappa())>0&&fabs(track.kappa())<1000.0&&fabs(track.tanl())<7.02) {
2784 // attention to this measure value ,what is the measurement value !!
2785 Hep3Vector meas = track.momentum(0).cross(wire).unit();
2786
2787 if(usage_>1) track.smoother_Mdc_csmalign(HelixSeg, meas,flag, m_csmflag);
2788 else track.smoother_Mdc(HelixSeg, meas,flag, m_csmflag);
2789 // cout<<"layer, cell, track.a: "<<Wire.layer().layerId()<<" , "<<Wire.localId()<<" , "<<track.a()<<endl;
2790 }
2791
2792 if (debug_) cout<<"track----7-----"<<track.a()<<endl;
2793 r0kal_prec = r0kal;
2794 // can this kind of operation be right??
2795 if(flag == 0) {
2796 track.HelixSegs().erase(track.HelixSegs().begin()+iseg);
2797 }
2798 }
2799}

Referenced by complete_track().

◆ smoother_calib() [2/2]

void KalFitAlg::smoother_calib ( KalFitTrack trk,
int  way 
)

◆ start_seed() [1/2]

void KalFitAlg::start_seed ( KalFitTrack track,
int  lead_,
int  way,
MdcRec_trk trk 
)

Definition at line 6120 of file KalFitAlg.cxx.

6121{
6122 if (debug_ == 4)
6123 cout << "start_seed begin... " << std::endl;
6124 // keep initial helix parameters
6125 Hep3Vector x_init(track.pivot());
6126 HepSymMatrix Ea_init(5,0);
6127 Ea_init = track.Ea();
6128 HepVector a_init(5);
6129 a_init = track.a();
6130
6131 // LR assumption :
6132 unsigned int nhit_included(10);
6133 int LR[8][3] = {
6134 {1,1,1},
6135 {1,1,-1},
6136 {1,-1,1},
6137 {1,-1,-1},
6138 {-1,1,1},
6139 {-1,1,-1},
6140 {-1,-1,1},
6141 {-1,-1,-1}
6142 };
6143
6144 unsigned int nhit = track.HitsMdc().size();
6145 double chi2_min(DBL_MAX);
6146 int i_min(-1);
6147 for (int ktrial = 0; ktrial < 8; ktrial++) {
6148
6149 // Come back to trasan seed :
6150 track.pivot(x_init);
6151 track.a(a_init);
6152 track.Ea(Ea_init);
6153
6154 track.chiSq(0);
6155 track.chiSq_back(0);
6156 track.nchits(0);
6157 track.nster(0);
6158 track.ndf_back(0);
6159
6160 HepSymMatrix Eakal(5,0);
6161
6162 init_matrix(choice_,TrasanTRK, Eakal);
6163 // initialize the Mdc hits :
6164 for( unsigned i=0 ; i < nhit; i++ ){
6165 KalFitHitMdc& HitMdc = track.HitMdc(i);
6166 int lr_decision(0);
6167 if (i<3) lr_decision = LR[ktrial][i];
6168 HitMdc.LR(lr_decision);
6169 if (i<nhit_included)
6170 HitMdc.chi2(0);
6171 else
6172 HitMdc.chi2(-1);
6173 }
6174 // Mdc fit the ... first hits :
6175
6176 if(usage_==0) filter_fwd_anal(track, lead_, way, Eakal);
6177 way=999;
6178 if(usage_>0) filter_fwd_calib(track, lead_, way, Eakal);
6179
6180 // Check the chi2
6181 if (debug_ == 4)
6182 cout << "---- Result for " << ktrial << " case : chi2 = " << track.chiSq()
6183 << ", nhits included = " << track.nchits() << " for nhits available = "
6184 << nhit << std::endl;
6185
6186 if (track.chiSq() < chi2_min &&
6187 (track.nchits() == nhit_included || track.nchits() == nhit)){
6188 chi2_min = track.chiSq();
6189 i_min = ktrial;
6190 }
6191 }
6192
6193 // Initialize to the best solution :
6194 if (debug_ == 4)
6195 cout << "*** i_min = " << i_min << " with a chi2 = " << chi2_min << std::endl;
6196
6197 for( unsigned i=0 ; i < nhit; i++ ){
6198 KalFitHitMdc& HitMdc = track.HitMdc(i);
6199 int lr_decision(0);
6200 if (i_min >= 0 && i < 3)
6201 lr_decision = LR[i_min][i];
6202 HitMdc.LR(lr_decision);
6203 HitMdc.chi2(0);
6204 HitMdc.chi2_back(0);
6205 }
6206 track.pivot(x_init);
6207 track.a(a_init);
6208 track.Ea(Ea_init);
6209 track.chiSq(0);
6210 track.chiSq_back(0);
6211 track.nchits(0);
6212 track.nster(0);
6213 track.ndf_back(0);
6214
6215 // For debugging purpose :
6216 if (debug_ == 4) {
6217 for( unsigned i=0 ; i < 3; i++ ){
6218 KalFitHitMdc& HitMdc = track.HitMdc(i);
6219 cout << " LR(" << i << ") = " << HitMdc.LR()
6220 << ", stereo = " << HitMdc.wire().stereo()
6221 << ", layer = " << HitMdc.wire().layer().layerId() << std::endl;
6222 }
6223 }
6224}

Referenced by kalman_fitting_anal(), kalman_fitting_calib(), kalman_fitting_csmalign(), and kalman_fitting_MdcxReco_Csmc_Sew().

◆ start_seed() [2/2]

void KalFitAlg::start_seed ( KalFitTrack track,
int  lead_,
int  way,
MdcRec_trk trk 
)

Member Data Documentation

◆ activeonly_

int KalFitAlg::activeonly_

◆ back_

int KalFitAlg::back_

flag to perform smoothing

Definition at line 189 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track(), initialize(), and KalFitAlg().

◆ choice_

◆ cylfile_

string KalFitAlg::cylfile_

Definition at line 231 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg().

◆ dchi2cut_inner_

double KalFitAlg::dchi2cut_inner_

Definition at line 235 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg(), and setDchisqCut().

◆ dchi2cut_layid2_

double KalFitAlg::dchi2cut_layid2_

Definition at line 235 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg(), and setDchisqCut().

◆ dchi2cut_layid3_

double KalFitAlg::dchi2cut_layid3_

Definition at line 235 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg(), and setDchisqCut().

◆ dchi2cut_mid1_

double KalFitAlg::dchi2cut_mid1_

Definition at line 235 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg(), and setDchisqCut().

◆ dchi2cut_mid2_

double KalFitAlg::dchi2cut_mid2_

Definition at line 235 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg(), and setDchisqCut().

◆ dchi2cut_outer_

double KalFitAlg::dchi2cut_outer_

Definition at line 235 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg(), and setDchisqCut().

◆ dchi2cutf_

double KalFitAlg::dchi2cutf_

Definition at line 233 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ dchi2cuts_

double KalFitAlg::dchi2cuts_

Definition at line 233 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ debug_

◆ debug_kft_

int KalFitAlg::debug_kft_

Definition at line 227 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ drifttime_choice_

int KalFitAlg::drifttime_choice_

Definition at line 222 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ enhance_

int KalFitAlg::enhance_

flag to enhance the error matrix at the inner hit of Mdc (cosmic)

Definition at line 209 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track().

◆ eventno

int KalFitAlg::eventno

Definition at line 191 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by execute().

◆ eventNo

int KalFitAlg::eventNo

◆ fac_h1_

double KalFitAlg::fac_h1_

Definition at line 210 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track().

◆ fac_h2_

double KalFitAlg::fac_h2_

Definition at line 210 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track().

◆ fac_h3_

double KalFitAlg::fac_h3_

Definition at line 210 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track().

◆ fac_h4_

double KalFitAlg::fac_h4_

Definition at line 210 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track().

◆ fac_h5_

double KalFitAlg::fac_h5_

Definition at line 210 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track().

◆ fitnocut_

int KalFitAlg::fitnocut_

◆ fstrag_

double KalFitAlg::fstrag_

factor of energy loss straggling for electron

Definition at line 238 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ gain1_

double KalFitAlg::gain1_

Definition at line 212 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by init_matrix(), and KalFitAlg().

◆ gain2_

double KalFitAlg::gain2_

Definition at line 212 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by init_matrix(), and KalFitAlg().

◆ gain3_

double KalFitAlg::gain3_

Definition at line 212 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by init_matrix(), and KalFitAlg().

◆ gain4_

double KalFitAlg::gain4_

Definition at line 212 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by init_matrix(), and KalFitAlg().

◆ gain5_

double KalFitAlg::gain5_

Definition at line 212 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by init_matrix(), and KalFitAlg().

◆ i_back_

int KalFitAlg::i_back_

mass assumption for backward filter (if <0 means use leading mass)

Definition at line 224 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track(), and KalFitAlg().

◆ i_front_

int KalFitAlg::i_front_

◆ inner_steps_

int KalFitAlg::inner_steps_

Definition at line 216 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ iqual_back_

int KalFitAlg::iqual_back_

Definition at line 241 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by execute(), and fillTds_back().

◆ iqual_front_

int KalFitAlg::iqual_front_

◆ lead_

◆ loss_

int KalFitAlg::loss_

◆ lr_

int KalFitAlg::lr_

Definition at line 207 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ m_alpha

double KalFitAlg::m_alpha

Definition at line 249 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by fitGemHits().

◆ m_csmflag

◆ m_dangcut

double KalFitAlg::m_dangcut

Definition at line 248 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by execute(), and KalFitAlg().

◆ m_dphicut

double KalFitAlg::m_dphicut

Definition at line 248 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by execute(), and KalFitAlg().

◆ m_usevtxdb

int KalFitAlg::m_usevtxdb

◆ matfile_

string KalFitAlg::matfile_

Definition at line 231 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by KalFitAlg().

◆ matrixg_

◆ mhyp_

int KalFitAlg::mhyp_

◆ muls_

int KalFitAlg::muls_

Flag account to multiple scattering and energy loss, where lr flag from and whether use active hits only

Definition at line 207 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by beginRun(), fitGemHits(), fromFHitToInnerWall(), initialize(), and KalFitAlg().

◆ ntuple_

◆ numf_

int KalFitAlg::numf_

Definition at line 215 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ numf_in_

int KalFitAlg::numf_in_

◆ numf_out_

int KalFitAlg::numf_out_

◆ numfcor_

int KalFitAlg::numfcor_

Definition at line 214 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ outer_steps_

int KalFitAlg::outer_steps_

Definition at line 217 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ pathl_

int KalFitAlg::pathl_

◆ pe_cut_

double KalFitAlg::pe_cut_

value of the momentum cut to decide refit

Definition at line 201 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track(), and KalFitAlg().

◆ pk_cut_

double KalFitAlg::pk_cut_

◆ pmu_cut_

double KalFitAlg::pmu_cut_

◆ pp_cut_

double KalFitAlg::pp_cut_

◆ ppi_cut_

double KalFitAlg::ppi_cut_

◆ pT_

double KalFitAlg::pT_

value of the pT cut for backward filter

Definition at line 195 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track(), initialize(), and KalFitAlg().

◆ pt_cut_

◆ resolution_

int KalFitAlg::resolution_

Definition at line 240 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ steplev_

int KalFitAlg::steplev_

Definition at line 213 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ Tds_back_no

int KalFitAlg::Tds_back_no

◆ theta_cut_

◆ tof_hyp_

int KalFitAlg::tof_hyp_

Definition at line 207 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ tofflag_

int KalFitAlg::tofflag_

Definition at line 207 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ tprop_

int KalFitAlg::tprop_

propagation correction

Definition at line 244 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by initialize(), and KalFitAlg().

◆ usage_

int KalFitAlg::usage_

this usage is used to control the usage of this algorithm ,to be analysis or calibration.

Definition at line 181 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by complete_track(), execute(), fillTds_back(), filter_fwd_calib(), KalFitAlg(), setDchisqCut(), smoother_calib(), and start_seed().

◆ wsag_

int KalFitAlg::wsag_

flag to take account the wire sag into account

Definition at line 187 of file InstallArea/include/KalFitAlg/KalFitAlg/KalFitAlg.h.

Referenced by execute(), filter_fwd_anal(), filter_fwd_calib(), initialize(), KalFitAlg(), smoother_anal(), and smoother_calib().


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