Main page |
Useful links |
||||||
What is LoKi?LoKi is C++ toolkit for the simple and user-friendly data analysis. LoKi is based on Gaudi architecture. The functionality of LoKi includes the selection of particles, manipulation with predefined kinematical expressions, loops over combinations of selected particles, creation of composite particles from various combinations of particles, flexible manipulation with various kinematical constrains, simplified population of histograms, N-Tuples, Event Tag Collections and access to Monte Carlo truth information. It uses many tools and classes from DaVinci/Phys/Analysis/LHCb/Gaudi projects. Also LoKi is the underlying package for Bender - Interactive Python-based Physics analysis Environment. Some more words about LoKiClose the tipC++ is currently the best suited language for large scale OO software projects. Unfortunately C++ requires significant amount of efforts from beginners to obtain some first results of acceptable quality. Often a simple operation corresponding to one “physics” statement results in an enormous code with complicated and probably non-obvious content.
1 ParticleVector::const_iterator im;
2 for(im=vDsK.begin(); im!=vDsK.end(); im++) { 3 if((*im)->particleID().pid()==m_DsPlusID|| 4 (*im)->particleID().pid()==m_DsMinusID) 5   vDs.push_back(*im); 6 elseif((*im)->particleID().pid()==m_KPPlusID|| 7 (*im)->particleID().pid()==m_KPMinusID) 8 vK.push_back(*im); 9 else{ 10 log<<MSG<<ERROR<<"some_message_here"<<endreq; 11 return StatisCode::FAILURE; 12 }} The usage of comments becomes mandatory for understanding makes the code even longer and again results in additional complexity. The idea of LoKi is to provide the users with possibility to write the code, which does not obscure the actual physics content by technical C++ semantic. The idea of user-friendly components for physics analysis were essentially induced by the spirit of following packages:
The attractiveness of specialized, physics-oriented code for physics analysis could be demonstrated e.g. with “typical” code fragment in KAL:
1 HYPOTH E+ MU+ PI + 5 K+ PROTON
2 3 IDENT PI + PI+ 4 IDENT K+ K+ 5 IDENT PROTON PROTON 6 IDENT E+ E+ 7 IDENT MU+ MU+ 8 9 SELECT K- PI+ 10 IF P &qt 2 THEN 11 SAVEFITM D0 DMASS 0 . 0 4 5 CHI2 16 12 ENDIF 13 ENDSEL 14 15 SELECT D0 PI+ 16 PLOT MASS L 2.0 H 2.100 NB 100 TEXT ’ Mass of D0 pi+’ 17 ENDSEL 18 19 GO 1000000 This KAL pseudo-code gives an example of self-explanatory code. The physical content of selection of D*+→D0π+ followed by D0→K—π0 decay is clear and unambigously visible between lines. Indeed no comments are needed for understanding the analysis within 2 minutes. One could argue that it is not possible to get the similar transparency of the physical content of code with native C++. The best answer to this argument could be just an example from T. Glebe’s PATTERN of K0S→π+π— reconstruction:
1 TrackPattern piMinus=pi_minus.with(pt>0.1 & p>1);
2 TrackPattern piPlus=piplus.with(pt>0.1 & p>1); 3 TwoProngDecay kShort=K0S.decaysTo(PiPlus & PiMinus); 4 kShort.with ( vz > 0 ); 5 kShort.with ( pt > 0.1 ); This code fragment is not so transparent as specialized KAL pseudo-code but it is easy-to-read, the physical content is clear, and it is just a native C++ ! I personally tend to consider the above code as an experimental prove of possibility to develop easy-to-use C++ package for physics analysis. Indeed the work has been started soon after I’ve seen these 5 lines. Here it is a good moment to jump to the end of the whole story and present some LoKi fragment for illustration:
1 select("Pi+", ID=="pi+" && CL>0.01 && P>5*GeV);
2 select("K-", ID=="K-" && CL>0.01 && P>5*GeV); 3 for (Loop D0 = loop("K- pi+", "D0"); D0; ++D0) 4 { 5 if(P(D0)>10*GeV){D0->save("D0");} 6 } 7 for(Loop Dstar=loop("D0 Pi+", "D*+"); Dstar; ++Dstar) 8 { 9 plot(M(Dsatr)/GeV,"Mass of D0 pi+ in GeV",2.0,2.1,100); 10 } The physical content of these lines is quite transparent. Close the tipLoKi Savannah portalSavannah portal is established for LoKi project. Please use it for bug reports, browsing bugs history, submission and browsing of the patches. Please register on Savannah to be able to use all useful functionality of Savannah, including the important notifications concerning the project development and evolution. See the current list of project members. How to register? DocumentationHere you will fined related documentation: manuals, tutorials and also talks. Bug reportsYou can report bugs or view bug histories via LoKi Savannah portal. Also LoKi mailing list could be used for bug-reports. Who is Loki?Loki is a god of wit and mischief in Norse mythology. The god of fire. The one that always wanted to break the constant rules and to bring the breath of changing to the world;) |
|||||||