Changes in / [91ef0b8:0d65492] in git
- Files:
-
- 1 added
- 1 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r91ef0b8 r0d65492 660 660 tmp/external/TrackCovariance/TrkUtil.$(ObjSuf): \ 661 661 external/TrackCovariance/TrkUtil.$(SrcSuf) 662 tmp/external/TrackCovariance/VertexFit.$(ObjSuf): \663 external/TrackCovariance/VertexFit.$(SrcSuf)664 662 tmp/modules/AngularSmearing.$(ObjSuf): \ 665 663 modules/AngularSmearing.$(SrcSuf) \ … … 1170 1168 tmp/external/TrackCovariance/SolTrack.$(ObjSuf) \ 1171 1169 tmp/external/TrackCovariance/TrkUtil.$(ObjSuf) \ 1172 tmp/external/TrackCovariance/VertexFit.$(ObjSuf) \1173 1170 tmp/modules/AngularSmearing.$(ObjSuf) \ 1174 1171 tmp/modules/BTagging.$(ObjSuf) \ -
README.md
r91ef0b8 r0d65492 1 [![C I](https://github.com/delphes/delphes/actions/workflows/ci.yml/badge.svg)](https://github.com/delphes/delphes/actions/workflows/ci.yml) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3735069.svg)](https://doi.org/10.5281/zenodo.3735069)1 [![CircleCI](https://circleci.com/gh/delphes/delphes.svg?style=shield)](https://circleci.com/gh/delphes/delphes) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3735069.svg)](https://doi.org/10.5281/zenodo.3735069) 2 2 3 3 Delphes -
cards/delphes_card_IDEAtrkCov.tcl
r91ef0b8 r0d65492 8 8 # michele.selvaggi@cern.ch 9 9 ##################################################################### 10 11 set B 2.0 12 10 # 13 11 ####################################### 14 12 # Order of execution of various modules … … 61 59 TreeWriter 62 60 } 61 63 62 64 63 ################################# … … 81 80 82 81 # magnetic field, in T 83 set Bz $B82 set Bz 2.0 84 83 } 85 84 … … 311 310 } 312 311 313 set Bz $B 314 } 312 set Bz 2.0 313 } 314 315 315 316 316 ############## … … 767 767 add Branch MissingET/momentum MissingET MissingET 768 768 add Branch ScalarHT/energy ScalarHT ScalarHT 769 770 # add Info InfoName InfoValue 771 add Info Bz $B 772 } 769 } -
classes/DelphesClasses.cc
r91ef0b8 r0d65492 112 112 TMatrixDSym Cv; 113 113 Cv.ResizeTo(5, 5); 114 114 115 115 // convert diagonal term to original units 116 Cv(0, 0)=TMath::Power(ErrorD0 , 2.);116 Cv(0, 0)=TMath::Power(ErrorD0*1.0E-3, 2.); 117 117 Cv(1, 1)=TMath::Power(ErrorPhi, 2.); 118 Cv(2, 2)=TMath::Power(ErrorC , 2.);119 Cv(3, 3)=TMath::Power(ErrorDZ , 2.);118 Cv(2, 2)=TMath::Power(ErrorC*1.0E3, 2.); 119 Cv(3, 3)=TMath::Power(ErrorDZ*1.0E-3, 2.); 120 120 Cv(4, 4)=TMath::Power(ErrorCtgTheta, 2.); 121 121 … … 171 171 TMatrixDSym Cv; 172 172 Cv.ResizeTo(5, 5); 173 173 174 174 // convert diagonal term to original units 175 Cv(0, 0)=TMath::Power(ErrorD0 , 2.);175 Cv(0, 0)=TMath::Power(ErrorD0*1.0E-3, 2.); 176 176 Cv(1, 1)=TMath::Power(ErrorPhi, 2.); 177 Cv(2, 2)=TMath::Power(ErrorC , 2.);178 Cv(3, 3)=TMath::Power(ErrorDZ , 2.);177 Cv(2, 2)=TMath::Power(ErrorC*1.0E3, 2.); 178 Cv(3, 3)=TMath::Power(ErrorDZ*1.0E-3, 2.); 179 179 Cv(4, 4)=TMath::Power(ErrorCtgTheta, 2.); 180 180 … … 234 234 NNeutrals(0), 235 235 NeutralEnergyFraction(0), // charged energy fraction 236 ChargedEnergyFraction(0), // neutral energy fraction 236 ChargedEnergyFraction(0), // neutral energy fraction 237 237 Beta(0), 238 238 BetaStar(0), -
classes/DelphesModule.cc
r91ef0b8 r0d65492 130 130 //------------------------------------------------------------------------------ 131 131 132 void DelphesModule::AddInfo(const char *name, Double_t value)133 {134 stringstream message;135 if(!fTreeWriter)136 {137 fTreeWriter = static_cast<ExRootTreeWriter *>(GetObject("TreeWriter", ExRootTreeWriter::Class()));138 if(!fTreeWriter)139 {140 message << "can't access access tree writer";141 throw runtime_error(message.str());142 }143 }144 fTreeWriter->AddInfo(name, value);145 }146 147 //------------------------------------------------------------------------------148 149 132 ExRootResult *DelphesModule::GetPlots() 150 133 { -
classes/DelphesModule.h
r91ef0b8 r0d65492 55 55 56 56 ExRootTreeBranch *NewBranch(const char *name, TClass *cl); 57 void AddInfo(const char *name, Double_t value);58 57 59 58 ExRootResult *GetPlots(); -
examples/Example6.C
r91ef0b8 r0d65492 64 64 // CEntral track over min Pt 65 65 TH1* histPtgenC = new TH1F("h_PtgenC", "Generated Pt - Central", 500, 0., 50.); // pt for central tracks; 66 TH1* histPtobsC = new TH1F("h_PtobsC", "Reconstructed Pt - Central", 500, 0., 50.); // pt for central 66 TH1* histPtobsC = new TH1F("h_PtobsC", "Reconstructed Pt - Central", 500, 0., 50.); // pt for central 67 67 TH1* histCtgenH = new TH1F("h_CtgenH", "Generateded Cotangent", 100, -10., 10.); // cot(theta) for high pt tracks; 68 68 TH1* histCtobsH = new TH1F("h_CtobsH", "Reconstructed Cotangent", 100, -10., 10.); // cot(theta) for high pt tracks … … 77 77 // 78 78 // Get magnetifc field 79 Double_t Bz = treeReader->GetInfo("Bz");79 Double_t Bz = 2.0; 80 80 81 81 // Loop over all events … … 107 107 histCtobs->Fill(obsCtg); 108 108 // 109 // Get associated generated particle 109 // Get associated generated particle 110 110 GenParticle* gp = (GenParticle*)trk->Particle.GetObject(); 111 111 // … … 162 162 GenParticle* gpart = (GenParticle*)branchGenPart->At(it); 163 163 // 164 // Plot charged particle parameters 164 // Plot charged particle parameters 165 165 // Only final state particles (Status = 1) 166 166 if (gpart->Status == 1 && TMath::Abs(gpart->Charge) > 0) { … … 290 290 histAccCtgH->Draw(); 291 291 Cnv5->cd(3); gPad->SetLogy(1); 292 histPtgenC->Draw(); 292 histPtgenC->Draw(); 293 293 histPtobsC->SetLineColor(kRed); 294 294 histPtobsC->Draw("SAME"); -
examples/ExamplePVtxFit.C
r91ef0b8 r0d65492 1 1 /* 2 2 Example of using vertex fitter class to fit primary vertex 3 assumed to be generated in (0,0,0) 3 assumed to be generated in (0,0,0). 4 To run compiled version: 5 root 6 root> .L examples/LoadPvtxFit.C+ 7 root> LoadPVtxFit() 8 root> ExamplePVtxFit("infile.root", Nevents) 9 10 March 4, 2021 11 F. Bedeschi, INFN-Pisa, Italy 4 12 */ 5 6 #ifdef __CLING__7 R__LOAD_LIBRARY(libDelphes)8 13 9 14 #include "classes/DelphesClasses.h" … … 13 18 #include "external/TrackCovariance/VertexFit.h" 14 19 15 #endif 16 20 #include <TClonesArray.h> 21 #include <TChain.h> 22 #include <TVectorD.h> 23 #include <TMatrixDSym.h> 24 #include <TH1.h> 25 #include <TCanvas.h> 26 #include <TStyle.h> 17 27 18 28 //------------------------------------------------------------------------------ … … 40 50 // 41 51 // Loop over all events 42 Int_t Nev = TMath::Min(Nevent, (Int_t) numberOfEntries);52 Int_t Nev = TMath::Min(Nevent, (Int_t) numberOfEntries); 43 53 for (Int_t entry = 0; entry < Nev; ++entry) 44 54 { … … 46 56 treeReader->ReadEntry(entry); 47 57 Int_t Ntr = 0; // # of tracks from primary vertex 48 Int_t NtrG = branchTrack->GetEntries(); 58 Int_t NtrG = branchTrack->GetEntries(); // Total # of tracks 49 59 TVectorD** pr = new TVectorD * [NtrG]; 50 60 TMatrixDSym** cv = new TMatrixDSym * [NtrG]; … … 58 68 Track* trk = (Track*)branchTrack->At(it); 59 69 // 60 // Get associated generated particle 70 // Get associated generated particle 61 71 GenParticle* gp = (GenParticle*)trk->Particle.GetObject(); 62 72 // 63 // Position of origin in mm73 // Position of origin (mm) 64 74 Double_t x = gp->X; 65 75 Double_t y = gp->Y; 66 76 Double_t z = gp->Z; 67 77 // 68 // grouptracks originating from the primary vertex78 // Select group of tracks originating from the primary vertex 69 79 if (x == 0.0 && y == 0.0) 70 80 { … … 80 90 // 81 91 pr[Ntr] = new TVectorD(obsPar); 82 //std::cout<<"Cov Matrix:"<<std::endl; 83 //trk->CovarianceMatrix().Print(); 84 cv[Ntr] = new TMatrixDSym(trk->CovarianceMatrix()); 92 cv[Ntr] = new TMatrixDSym(TrkUtil::CovToMm(trk->CovarianceMatrix())); 85 93 Ntr++; 86 94 } … … 107 115 } 108 116 109 //std::cout << "Vertex chi2/Ndof = " << Chi2 / Ndof << std::endl;110 117 // 111 118 // Cleanup … … 118 125 // Show resulting histograms 119 126 // 120 TCanvas* Cnv = new TCanvas("Cnv", "Delphes primary vertex pulls", 50, 50, 900, 500);127 TCanvas* Cnv = new TCanvas("Cnv", "Delphes primary vertex fit pulls", 50, 50, 900, 500); 121 128 Cnv->Divide(2, 2); 122 Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111); 129 Cnv->cd(1); gPad->SetLogy(1); gStyle->SetOptFit(1111); 123 130 hXpull->Fit("gaus"); hXpull->Draw(); 124 Cnv->cd(2); gPad->SetLogy(1); gStyle->SetOptFit(1111); 131 Cnv->cd(2); gPad->SetLogy(1); gStyle->SetOptFit(1111); 125 132 hYpull->Fit("gaus"); hYpull->Draw(); 126 133 Cnv->cd(3); gPad->SetLogy(1); gStyle->SetOptFit(1111); -
external/ExRootAnalysis/ExRootTreeReader.cc
r91ef0b8 r0d65492 12 12 #include "TBranchElement.h" 13 13 #include "TCanvas.h" 14 #include "TParameter.h"15 14 #include "TClonesArray.h" 16 15 #include "TH2.h" … … 120 119 //------------------------------------------------------------------------------ 121 120 122 Double_t ExRootTreeReader::GetInfo(const char *name)123 {124 TTree *tree = NULL;125 TParameter<Double_t> *param = NULL;126 Double_t result = -999.9;127 if(fChain) tree = fChain->GetTree();128 if(tree) param = static_cast<TParameter<Double_t> *>(tree->GetUserInfo()->FindObject(name));129 if(param) result = param->GetVal();130 return result;131 }132 133 //------------------------------------------------------------------------------134 135 121 Bool_t ExRootTreeReader::Notify() 136 122 { -
external/ExRootAnalysis/ExRootTreeReader.h
r91ef0b8 r0d65492 29 29 30 30 TClonesArray *UseBranch(const char *branchName); 31 Double_t GetInfo(const char *name);32 31 33 32 private: -
external/ExRootAnalysis/ExRootTreeWriter.cc
r91ef0b8 r0d65492 11 11 #include "ExRootAnalysis/ExRootTreeBranch.h" 12 12 13 #include "TParameter.h"14 13 #include "TClonesArray.h" 15 14 #include "TFile.h" … … 49 48 fBranches.insert(branch); 50 49 return branch; 51 }52 53 //------------------------------------------------------------------------------54 55 void ExRootTreeWriter::AddInfo(const char *name, Double_t value)56 {57 if(!fTree) fTree = NewTree();58 fTree->GetUserInfo()->Add(new TParameter<Double_t>(name, value));59 50 } 60 51 -
external/ExRootAnalysis/ExRootTreeWriter.h
r91ef0b8 r0d65492 29 29 30 30 ExRootTreeBranch *NewBranch(const char *name, TClass *cl); 31 void AddInfo(const char *name, Double_t value);32 31 33 32 void Clear(); -
external/TrackCovariance/TrkUtil.cc
r91ef0b8 r0d65492 1 1 #include "TrkUtil.h" 2 #include <TMath.h>3 2 #include <iostream> 4 3 … … 32 31 Double_t r2 = x.Perp2(); 33 32 Double_t cross = x(0) * p(1) - x(1) * p(0); 34 Double_t T = TMath::Sqrt(pt * pt - 2 * a * cross + a * a * r2);35 Double_t phi0 = TMath::ATan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T); // Phi033 Double_t T = sqrt(pt * pt - 2 * a * cross + a * a * r2); 34 Double_t phi0 = atan2((p(1) - a * x(0)) / T, (p(0) + a * x(1)) / T); // Phi0 36 35 Double_t D; // Impact parameter D 37 36 if (pt < 10.0) D = (T - pt) / a; … … 42 41 Par(2) = C; // Store C 43 42 //Longitudinal parameters 44 Double_t B = C * TMath::Sqrt(TMath::Max(r2 - D * D, 0.0) / (1 + 2 * C * D));45 Double_t st = TMath::ASin(B) / C;43 Double_t B = C * sqrt(TMath::Max(r2 - D * D, 0.0) / (1 + 2 * C * D)); 44 Double_t st = asin(B) / C; 46 45 Double_t ct = p(2) / pt; 47 46 Double_t z0 = x(2) - ct * st; … … 70 69 // 71 70 TVector3 Xval; 72 Xval(0) = -D * TMath::Sin(phi0);73 Xval(1) = D * TMath::Cos(phi0);71 Xval(0) = -D * sin(phi0); 72 Xval(1) = D * cos(phi0); 74 73 Xval(2) = z0; 75 74 // … … 93 92 TVector3 Pval; 94 93 Double_t pt = Bz * cSpeed() / TMath::Abs(2 * C); 95 Pval(0) = pt * TMath::Cos(phi0);96 Pval(1) = pt * TMath::Sin(phi0);94 Pval(0) = pt * cos(phi0); 95 Pval(1) = pt * sin(phi0); 97 96 Pval(2) = pt * ct; 98 97 // … … 115 114 pACTS(1) = 1000 * Par(3); // z0 from m to mm 116 115 pACTS(2) = Par(1); // Phi0 is unchanged 117 pACTS(3) = TMath::ATan2(1.0, Par(4)); // Theta in [0, pi] range118 pACTS(4) = Par(2) / (b * TMath::Sqrt(1 + Par(4) * Par(4))); // q/p in GeV116 pACTS(3) = atan2(1.0, Par(4)); // Theta in [0, pi] range 117 pACTS(4) = Par(2) / (b * sqrt(1 + Par(4) * Par(4))); // q/p in GeV 119 118 pACTS(5) = 0.0; // Time: currently undefined 120 119 // … … 133 132 A(0, 0) = 1000.; // D-D conversion to mm 134 133 A(1, 2) = 1.0; // phi0-phi0 135 A(2, 4) = 1.0 / ( TMath::Sqrt(1.0 + ct * ct) * b); // q/p-C134 A(2, 4) = 1.0 / (sqrt(1.0 + ct * ct) * b); // q/p-C 136 135 A(3, 1) = 1000.; // z0-z0 conversion to mm 137 136 A(4, 3) = -1.0 / (1.0 + ct * ct); // theta - cot(theta) 138 A(4, 4) = -C * ct / (b * TMath::Power(1.0 + ct * ct, 3.0 / 2.0)); // q/p-cot(theta)137 A(4, 4) = -C * ct / (b * pow(1.0 + ct * ct, 3.0 / 2.0)); // q/p-cot(theta) 139 138 // 140 139 TMatrixDSym Cv = Cov; -
external/TrackCovariance/VertexFit.cc
r91ef0b8 r0d65492 15 15 fVtxCst = kFALSE; 16 16 fxCst.ResizeTo(3); 17 fCovCst.ResizeTo(3, 17 fCovCst.ResizeTo(3,3); 18 18 fXv.ResizeTo(3); 19 fcovXv.ResizeTo(3, 19 fcovXv.ResizeTo(3,3); 20 20 } 21 21 // Parameters and covariances … … 26 26 fVtxCst = kFALSE; 27 27 fxCst.ResizeTo(3); 28 fCovCst.ResizeTo(3, 28 fCovCst.ResizeTo(3,3); 29 29 fXv.ResizeTo(3); 30 fcovXv.ResizeTo(3, 30 fcovXv.ResizeTo(3,3); 31 31 // 32 32 fPar = trkPar; … … 35 35 // 36 36 ffi = new Double_t[Ntr]; // Fit phases 37 fx0i = new TVectorD 37 fx0i = new TVectorD* [Ntr]; // Track expansion points 38 38 for (Int_t i = 0; i < Ntr; i++) fx0i[i] = new TVectorD(3); 39 39 fai = new TVectorD * [Ntr]; // dx/dphi 40 40 for (Int_t i = 0; i < Ntr; i++) fai[i] = new TVectorD(3); 41 41 fa2i = new Double_t[Ntr]; // a'Wa 42 fDi = new TMatrixDSym *[Ntr]; // W-WBW42 fDi = new TMatrixDSym*[Ntr]; // W-WBW 43 43 for (Int_t i = 0; i < Ntr; i++) fDi[i] = new TMatrixDSym(3); 44 44 fWi = new TMatrixDSym * [Ntr]; // (ACA')^-1 … … 46 46 fWinvi = new TMatrixDSym * [Ntr]; // ACA' 47 47 for (Int_t i = 0; i < Ntr; i++) fWinvi[i] = new TMatrixDSym(3); 48 48 49 } 49 50 // ObsTrk list … … 54 55 fVtxCst = kFALSE; 55 56 fxCst.ResizeTo(3); 56 fCovCst.ResizeTo(3, 57 fCovCst.ResizeTo(3,3); 57 58 fXv.ResizeTo(3); 58 fcovXv.ResizeTo(3, 59 // 60 fPar = new TVectorD *[Ntr];61 fCov = new TMatrixDSym *[Ntr];59 fcovXv.ResizeTo(3,3); 60 // 61 fPar = new TVectorD*[Ntr]; 62 fCov = new TMatrixDSym*[Ntr]; 62 63 fChi2List.ResizeTo(Ntr); 63 64 for (Int_t i = 0; i < Ntr; i++) 64 65 { 65 66 fPar[i] = new TVectorD(track[i]->GetObsPar()); 67 //cout << "fPar = " << endl; fPar[i]->Print(); 66 68 fCov[i] = new TMatrixDSym(track[i]->GetCov()); 69 //cout << "fCov = " << endl; fCov[i]->Print(); 67 70 } 68 71 // … … 79 82 fWinvi = new TMatrixDSym * [Ntr]; // ACA' 80 83 for (Int_t i = 0; i < Ntr; i++) fWinvi[i] = new TMatrixDSym(3); 84 85 //cout << "VertexFit constructor executed" << endl; 81 86 } 82 87 // … … 84 89 VertexFit::~VertexFit() 85 90 { 86 fxCst.Clear(); 91 fxCst.Clear(); 87 92 fCovCst.Clear(); 88 fXv.Clear(); 89 fcovXv.Clear(); 93 fXv.Clear(); 94 fcovXv.Clear(); 90 95 fChi2List.Clear(); 91 96 // 92 for (Int_t i 93 { 94 fPar[i]->Clear(); 97 for (Int_t i= 0; i < fNtr; i++) 98 { 99 fPar[i]->Clear(); 95 100 fCov[i]->Clear(); 96 101 // … … 143 148 H(1, 1) = nn; 144 149 TVectorD c(2); 145 c(0) = 0; for (Int_t i = 0; i < 3; i++)c(0) += n(i) * (y0(i) - x0(i));150 c(0) = 0; for (Int_t i = 0; i < 3; i++)c(0) += n(i) * (y0(i) - x0(i)); 146 151 c(1) = 0; for (Int_t i = 0; i < 3; i++)c(1) += -k(i) * (y0(i) - x0(i)); 147 152 TVectorD smin = (H * c); … … 153 158 Double_t R2 = TMath::Sqrt(Y(0) * Y(0) + Y(1) * Y(1)); 154 159 // 155 return 0.5 * (R1 +R2);160 return 0.5*(R1+R2); 156 161 } 157 162 Double_t VertexFit::FastRv(TVectorD p1, TVectorD p2) … … 165 170 TMatrixDSym H(2); 166 171 H(0, 0) = -TMath::Cos(p2(1)); 167 H(0, 1) = TMath::Cos(p1(1));172 H(0, 1) = TMath::Cos(p1(1)); 168 173 H(1, 0) = -TMath::Sin(p2(1)); 169 H(1, 1) = TMath::Sin(p1(1));174 H(1, 1) = TMath::Sin(p1(1)); 170 175 Double_t Det = TMath::Sin(p2(1) - p1(1)); 171 176 H *= 1.0 / Det; … … 190 195 if (Ntry > NtryMax) 191 196 { 192 std::cout << "FastRv: maximum number of iteration reached" << std::endl;197 cout << "FastRv: maximum number of iteration reached" << endl; 193 198 break; 194 199 } … … 203 208 } 204 209 205 TMatrixDSym VertexFit::RegInv3(TMatrixDSym &Smat0)210 TMatrixDSym VertexFit::RegInv3(TMatrixDSym &Smat0) 206 211 { 207 212 // … … 212 217 if (N != 3) 213 218 { 214 std::cout << "RegInv3 called with matrix size != 3. Abort & return standard inversion." << std::endl;219 cout << "RegInv3 called with matrix size != 3. Abort & return standard inversion." << endl; 215 220 return Smat.Invert(); 216 221 } … … 227 232 for (Int_t j = 0; j < 2; j++)Q(i, j) = RegMat(i, j); 228 233 } 229 Double_t Det = 1 - Q(0, 1) *Q(1, 0);234 Double_t Det = 1 - Q(0, 1)*Q(1, 0); 230 235 TMatrixDSym H(2); 231 236 H = Q; … … 236 241 p(1) = RegMat(1, 2); 237 242 Double_t pHp = H.Similarity(p); 238 Double_t h = pHp -Det;243 Double_t h = pHp-Det; 239 244 // 240 245 TMatrixDSym pp(2); pp.Rank1Update(p); 241 TMatrixDSym F = (h *H) - pp.Similarity(H);246 TMatrixDSym F = (h*H) - pp.Similarity(H); 242 247 F *= 1.0 / Det; 243 TVectorD b = H *p;248 TVectorD b = H*p; 244 249 TMatrixDSym InvReg(3); 245 250 for (Int_t i = 0; i < 2; i++) … … 258 263 else 259 264 { 260 D.Zero(); 261 for (Int_t i = 0; i < N; i++) D(i, i) = 1.0 / TMath::Sqrt(TMath::Abs(Smat(i, i))); 262 TMatrixDSym RegMat = Smat.Similarity(D); 263 RegMat.Invert(); 264 return RegMat.Similarity(D); 265 cout << "RegInv3: found negative elements in diagonal. Return standard inversion." << endl; 266 return Smat.Invert(); 265 267 } 266 268 } … … 292 294 A(2, 0) = 0.0; 293 295 // phi0 294 A(0, 1) = -D *TMath::Cos(p0) + (TMath::Cos(phi + p0) - TMath::Cos(p0)) / (2 * C);295 A(1, 1) = -D *TMath::Sin(p0) + (TMath::Sin(phi + p0) - TMath::Sin(p0)) / (2 * C);296 A(0, 1) = -D*TMath::Cos(p0) + (TMath::Cos(phi + p0) - TMath::Cos(p0)) / (2 * C); 297 A(1, 1) = -D*TMath::Sin(p0) + (TMath::Sin(phi + p0) - TMath::Sin(p0)) / (2 * C); 296 298 A(2, 1) = 0.0; 297 299 // C 298 A(0, 2) = -(TMath::Sin(phi + p0) - TMath::Sin(p0)) / (2 * C *C);299 A(1, 2) = (TMath::Cos(phi + p0) - TMath::Cos(p0)) / (2 * C *C);300 A(2, 2) = -ct * phi / (2 * C *C);300 A(0, 2) = -(TMath::Sin(phi + p0) - TMath::Sin(p0)) / (2 * C*C); 301 A(1, 2) = (TMath::Cos(phi + p0) - TMath::Cos(p0)) / (2 * C*C); 302 A(2, 2) = -ct*phi / (2 * C*C); 301 303 // z0 302 304 A(0, 3) = 0.0; … … 351 353 Double_t ct = par(4); 352 354 // 353 x0(0) = -D * 354 x0(1) = D *TMath::Cos(p0);355 x0(0) = -D *TMath::Sin(p0); 356 x0(1) = D*TMath::Cos(p0); 355 357 x0(2) = z0; 356 358 // … … 376 378 x(0) = x0(0) + (TMath::Sin(phi + p0) - TMath::Sin(p0)) / (2 * C); 377 379 x(1) = x0(1) - (TMath::Cos(phi + p0) - TMath::Cos(p0)) / (2 * C); 378 x(2) = x0(2) + ct *phi / (2 * C);380 x(2) = x0(2) + ct*phi / (2 * C); 379 381 // 380 382 return x; … … 393 395 // 394 396 // Stored quantities 395 Double_t * fi = new Double_t[fNtr]; // Phases396 TVectorD ** x0i = new TVectorD *[fNtr]; // Track expansion point397 TVectorD ** ai = new TVectorD *[fNtr]; // dx/dphi398 Double_t *a2i = new Double_t[fNtr]; // a'Wa399 TMatrixDSym ** Di = new TMatrixDSym *[fNtr]; // W-WBW400 TMatrixDSym ** Wi = new TMatrixDSym *[fNtr]; // (ACA')^-1401 TMatrixDSym ** Winvi = new TMatrixDSym *[fNtr]; // ACA'397 Double_t *fi = new Double_t[fNtr]; // Phases 398 TVectorD **x0i = new TVectorD*[fNtr]; // Track expansion point 399 TVectorD **ai = new TVectorD*[fNtr]; // dx/dphi 400 Double_t *a2i = new Double_t[fNtr]; // a'Wa 401 TMatrixDSym **Di = new TMatrixDSym*[fNtr]; // W-WBW 402 TMatrixDSym **Wi = new TMatrixDSym*[fNtr]; // (ACA')^-1 403 TMatrixDSym **Winvi = new TMatrixDSym*[fNtr]; // ACA' 402 404 // 403 405 // vertex radius approximation … … 413 415 // 414 416 // Find track pair with largest phi difference 415 Int_t isel = 0; Int_t jsel = 0; // selected track indices 416 Double_t dphiMax = 0.0; // Max phi difference 417 418 for (Int_t i = 0; i < fNtr - 1; i++) 417 Int_t isel=0; Int_t jsel=0; // selected track indices 418 Double_t dphiMax = 0.0; // Max phi difference 419 for (Int_t i = 0; i < fNtr-1; i++) 419 420 { 420 421 //ObsTrk* ti = tracks[i]; … … 422 423 Double_t phi1 = pari(1); 423 424 424 for (Int_t j = i +1; j < fNtr; j++)425 for (Int_t j = i+1; j < fNtr; j++) 425 426 { 426 427 //ObsTrk* tj = tracks[j]; … … 437 438 } 438 439 // 440 // 441 //ObsTrk* t1 = tracks[isel]; 439 442 TVectorD p1 = *fPar[isel]; 443 //ObsTrk* t2 = tracks[jsel]; 440 444 TVectorD p2 = *fPar[jsel]; 441 445 Double_t R = FastRv1(p1, p2); 442 if (R > 1000.0) R = Rd; 443 R = 0.9 * R + 0.1 * Rd; 446 if (R > 1.0) R = Rd; 447 R = 0.9*R + 0.1*Rd; 448 // 449 //cout << "VertexFinder: fast R = " << R << endl; 444 450 // 445 451 // Iteration properties … … 458 464 H.Zero(); // Reset H matrix 459 465 DW1D.Zero(); 460 // 461 // std::cout << "VertexFinder: start loop on tracks" << std::endl;466 // 467 //cout << "VertexFinder: start loop on tracks" << endl; 462 468 for (Int_t i = 0; i < fNtr; i++) 463 469 { 464 // Get track helix parameters and their covariance matrix 470 // Get track helix parameters and their covariance matrix 471 //ObsTrk *t = tracks[i]; 465 472 TVectorD par = *fPar[i]; 466 TMatrixDSym Cov = *fCov[i]; 467 473 TMatrixDSym Cov = *fCov[i]; 468 474 Double_t fs; 469 475 if (Ntry <= 0) // Initialize all phases on first pass … … 471 477 Double_t D = par(0); 472 478 Double_t C = par(2); 473 Double_t arg = TMath::Max(1.0e-6, (R * R - D * D) / (1 + 2 * C *D));474 fs = 2 * TMath::ASin(C *TMath::Sqrt(arg));479 Double_t arg = TMath::Max(1.0e-6, (R*R - D*D) / (1 + 2 * C*D)); 480 fs = 2 * TMath::ASin(C*TMath::Sqrt(arg)); 475 481 fi[i] = fs; 476 482 } … … 478 484 // Starting values 479 485 // 480 fs = fi[i]; // Get phase481 // std::cout << "VertexFinder: phase fs set" << std::endl;486 fs = fi[i]; // Get phase 487 //cout << "VertexFinder: phase fs set" << endl; 482 488 TVectorD xs = Fill_x(par, fs); 483 // std::cout << "VertexFinder: position xs set" << std::endl;489 //cout << "VertexFinder: position xs set" << endl; 484 490 x0i[i] = new TVectorD(xs); // Start helix position 485 // std::cout << "VertexFinder: position x0i stored" << std::endl;491 //cout << "VertexFinder: position x0i stored" << endl; 486 492 // W matrix = (A*C*A')^-1; W^-1 = A*C*A' 487 493 TMatrixD A = Fill_A(par, fs); // A = dx/da = derivatives wrt track parameters 488 // std::cout << "VertexFinder: derivatives A set" << std::endl;494 //cout << "VertexFinder: derivatives A set" << endl; 489 495 TMatrixDSym Winv = Cov.Similarity(A); // W^-1 = A*C*A' 490 496 Winvi[i] = new TMatrixDSym(Winv); // Store W^-1 matrix 491 // std::cout << "VertexFinder: Winvi stored" << std::endl;497 //cout << "VertexFinder: Winvi stored" << endl; 492 498 TMatrixDSym W = RegInv3(Winv); // W = (A*C*A')^-1 493 499 Wi[i] = new TMatrixDSym(W); // Store W matrix 494 // std::cout << "VertexFinder: Wi stored" << std::endl;500 //cout << "VertexFinder: Wi stored" << endl; 495 501 TVectorD a = Fill_a(par, fs); // a = dx/ds = derivatives wrt phase 496 // std::cout << "VertexFinder: derivatives a set" << std::endl;502 //cout << "VertexFinder: derivatives a set" << endl; 497 503 ai[i] = new TVectorD(a); // Store a 498 // std::cout << "VertexFinder: derivatives a stored" << std::endl;504 //cout << "VertexFinder: derivatives a stored" << endl; 499 505 Double_t a2 = W.Similarity(a); 500 506 a2i[i] = a2; // Store a2 501 507 // Build D matrix 502 TMatrixDSym B(3); 503 508 TMatrixDSym B(3); 504 509 B.Rank1Update(a, 1.0); 505 510 B *= -1. / a2; 506 511 B.Similarity(W); 507 TMatrixDSym Ds = W +B; // D matrix512 TMatrixDSym Ds = W+B; // D matrix 508 513 Di[i] = new TMatrixDSym(Ds); // Store D matrix 509 // std::cout << "VertexFinder: matrix Di stored" << std::endl;514 //cout << "VertexFinder: matrix Di stored" << endl; 510 515 TMatrixDSym DsW1Ds = Winv.Similarity(Ds); // Service matrix to calculate covX 511 DW1D += DsW1Ds; 516 DW1D += DsW1Ds; 512 517 // Update hessian 513 518 H += Ds; … … 518 523 // update vertex position 519 524 TMatrixDSym H1 = RegInv3(H); 520 x = H1 *cterm;521 // std::cout << "VertexFinder: x vertex set" << std::endl;525 x = H1*cterm; 526 //cout << "VertexFinder: x vertex set" << endl; 522 527 // Update vertex covariance 523 528 covX = DW1D.Similarity(H1); 524 // std::cout << "VertexFinder: cov vertex set" << std::endl;529 //cout << "VertexFinder: cov vertex set" << endl; 525 530 // Update phases and chi^2 526 531 Chi2 = 0.0; 527 532 for (Int_t i = 0; i < fNtr; i++) 528 533 { 529 TVectorD lambda = (*Di[i]) *(*x0i[i] - x);534 TVectorD lambda = (*Di[i])*(*x0i[i] - x); 530 535 TMatrixDSym Wm1 = *Winvi[i]; 531 536 fChi2List(i) = Wm1.Similarity(lambda); 532 537 Chi2 += fChi2List(i); 533 538 TVectorD a = *ai[i]; 534 TVectorD b = (*Wi[i]) *(x - *x0i[i]);535 for (Int_t j = 0; j < 3; j++)fi[i] += a(j) *b(j) / a2i[i];539 TVectorD b = (*Wi[i])*(x - *x0i[i]); 540 for (Int_t j = 0; j < 3; j++)fi[i] += a(j)*b(j) / a2i[i]; 536 541 } 537 542 543 //cout << "VertexFinder: end chi2 calculation" << endl; 538 544 // 539 545 TVectorD dx = x - x0; … … 553 559 // 554 560 555 // std::cout << "VertexFinder: before store intermediate data" << std::endl;561 //cout << "VertexFinder: before store intermediate data" << endl; 556 562 for (Int_t i = 0; i < fNtr; i++) 557 563 { 558 // std::cout << "VertexFinder: inside store intermediate data" << std::endl;559 // std::cout << "i = " << i << ", fi[i] = " << fi[i] << std::endl;560 // std::cout << "i = " << i << ", ffi[i] = " << ffi[i] << std::endl;564 //cout << "VertexFinder: inside store intermediate data" << endl; 565 //cout << "i = " << i << ", fi[i] = " << fi[i] << endl; 566 //cout << "i = " << i << ", ffi[i] = " << ffi[i] << endl; 561 567 ffi[i] = fi[i]; // Fit phases 562 // std::cout << "VertexFinder: fi stored" << std::endl;568 //cout << "VertexFinder: fi stored" << endl; 563 569 fx0i[i] = x0i[i]; // Track expansion points 564 // std::cout << "VertexFinder: x0i stored" << std::endl;570 //cout << "VertexFinder: x0i stored" << endl; 565 571 fai[i] = ai[i]; // dx/dphi 566 // std::cout << "VertexFinder: ai stored" << std::endl;572 //cout << "VertexFinder: ai stored" << endl; 567 573 fa2i[i] = a2i[i]; // a'Wa 568 // std::cout << "VertexFinder: a2i stored" << std::endl;574 //cout << "VertexFinder: a2i stored" << endl; 569 575 fDi[i] = Di[i]; // W-WBW 570 // std::cout << "VertexFinder: Di stored" << std::endl;576 //cout << "VertexFinder: Di stored" << endl; 571 577 fWi[i] = Wi[i]; // (ACA')^-1 572 // std::cout << "VertexFinder: Wi stored" << std::endl;578 //cout << "VertexFinder: Wi stored" << endl; 573 579 fWinvi[i] = Winvi[i]; // ACA' 574 // std::cout << "VertexFinder: Winvi stored" << std::endl;580 //cout << "VertexFinder: Winvi stored" << endl; 575 581 } 576 // std::cout << "Iteration " << Ntry << " completed - Before cleanup" << std::endl;582 //cout << "Iteration " << Ntry << " completed - Before cleanup" << endl; 577 583 // 578 584 // Cleanup … … 593 599 } 594 600 595 // std::cout << "Iteration " << Ntry << " completed - After cleanup" << std::endl;601 //cout << "Iteration " << Ntry << " completed - After cleanup" << endl; 596 602 } 597 603 // 598 604 fVtxDone = kTRUE; // Set fitting completion flag 599 605 // 600 delete[] fi; // Phases 606 delete[] fi; // Phases 601 607 delete[] x0i; // Track expansion point 602 608 delete[] ai; // dx/dphi … … 609 615 TVectorD VertexFit::GetVtx() 610 616 { 611 // std::cout << "GetVtx: flag set to " << fVtxDone << std::endl;617 //cout << "GetVtx: flag set to " << fVtxDone << endl; 612 618 if (!fVtxDone)VertexFinder(); 613 619 return fXv; … … 635 641 void VertexFit::AddVtxConstraint(TVectorD xv, TMatrixDSym cov) // Add gaussian vertex constraint 636 642 { 637 std::cout << "VertexFit::AddVtxConstraint: Not implemented yet" << std::endl;643 cout << "VertexFit::AddVtxConstraint: Not implemented yet" << endl; 638 644 } 639 645 // 640 646 void VertexFit::AddTrk(TVectorD par, TMatrixDSym Cov) // Add track to input list 641 647 { 642 std::cout << "VertexFit::AddTrk: Not implemented yet" << std::endl;648 cout << "VertexFit::AddTrk: Not implemented yet" << endl; 643 649 } 644 650 void VertexFit::RemoveTrk(Int_t iTrk) // Remove iTrk track 645 651 { 646 std::cout << "VertexFit::RemoveTrk: Not implemented yet" << std::endl;647 } 652 cout << "VertexFit::RemoveTrk: Not implemented yet" << endl; 653 } -
modules/TreeWriter.cc
r91ef0b8 r0d65492 123 123 fBranchMap.insert(make_pair(branch, make_pair(itClassMap->second, array))); 124 124 } 125 126 param = GetParam("Info");127 TString infoName;128 Double_t infoValue;129 130 size = param.GetSize();131 for(i = 0; i < size / 2; ++i)132 {133 infoName = param[i * 2].GetString();134 infoValue = param[i * 2 + 1].GetDouble();135 136 AddInfo(infoName, infoValue);137 }138 125 } 139 126 … … 151 138 it1.Reset(); 152 139 array->Clear(); 153 140 154 141 while((candidate = static_cast<Candidate *>(it1.Next()))) 155 142 { … … 550 537 entry->CtgTheta = ctgTheta; 551 538 entry->C = candidate->C; 552 539 553 540 particle = static_cast<Candidate *>(candidate->GetCandidates()->At(0)); 554 541 const TLorentzVector &initialPosition = particle->Position;
Note:
See TracChangeset
for help on using the changeset viewer.