/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/EXAMPLE/lsh.cc File Reference

#include <signal.h>
#include <string>
#include <cstring>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <iomanip>
#include "lcio.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "EVENT/LCCollection.h"
#include "EVENT/SimTrackerHit.h"
#include "EVENT/SimCalorimeterHit.h"
#include "IO/LCReader.h"
#include "UTIL/LCTOOLS.h"
#include "EVENT/LCRunHeader.h"
#include "UTIL/LCTime.h"
#include <readline/readline.h>
#include <readline/history.h>

Include dependency graph for lsh.cc:

Go to the source code of this file.

Classes

struct  pagerInfo

Typedefs

typedef pair< int, string > level

Functions

const char * print_prompt ()
void leave (int ret)
void int_handler (int sig)
void term_handler (int sig)
void begin_paging (pagerInfo *file)
bool end_paging (pagerInfo *file)
void simplePrintCol (LCCollection *col)
void normalPrintCol (LCCollection *col)
void printTop ()
void fun_print (string colNr, string flag)
void lsRuns ()
void lsEvents ()
void lsCollections ()
void fun_ls ()
void fun_cd (string str)
void fun_dump (string arg)
void fun_egg ()
void fun_open (string filename)
void fun_help ()
int main (int argc, char **argv)

Variables

const int TOP = 0
const int RUN = 1
const int EVT = 2
const int COL = 3
vector< levelposition
map< int, string > mapRuns
map< int, int > mapEventsInRun
int numEvents = 0
bool withEvents = true
bool interrupt = false
bool pageOutput = false
string pager = "less"
string egg = "egg"
LCReader * lcReader
LCRunHeader * runHdr
LCEvent * event
LCCollection * col


Typedef Documentation

typedef pair<int, string> level

Definition at line 49 of file lsh.cc.


Function Documentation

const char* print_prompt (  ) 

PROMPT

Definition at line 85 of file lsh.cc.

Referenced by main().

00085                             {
00086   string prompt = "";
00087   
00088   vector<level>::iterator levelIt;
00089   vector<level>::iterator levelItEnd = position.end();
00090   for( levelIt = position.begin(); levelIt != levelItEnd ; levelIt++ ){
00091     prompt += levelIt->second ;
00092   }
00093   prompt += "$ ";
00094 
00095   return prompt.c_str();
00096 }

void leave ( int  ret  ) 

EXIT

Definition at line 107 of file lsh.cc.

Referenced by fun_cd(), main(), and term_handler().

00107                     {
00108   cout << endl;
00109   try {
00110     lcReader->close() ;
00111   }
00112   catch (exception& e) {
00113   }
00114   delete lcReader;
00115 //   
00116   exit(ret);
00117 }

void int_handler ( int  sig  ) 

SIGNAL HANDLERS

Definition at line 126 of file lsh.cc.

Referenced by main().

00126                           {
00127   cout << "interrupting.." << sig  << endl;
00128   interrupt = true;
00129 }

void term_handler ( int  sig  ) 

Definition at line 131 of file lsh.cc.

Referenced by main().

00131                            {
00132   cout << "leaving.." << endl;
00133   leave(1);
00134 }

void begin_paging ( pagerInfo file  ) 

PAGER HANDLING

Definition at line 143 of file lsh.cc.

Referenced by main().

00143                                   {
00144   if (!(file->save)) {
00145     file->filename = tmpnam (NULL);
00146   }
00147 
00148   // C style output redirection (changing file descriptors)
00149   file->fd_temp = open(file->filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
00150   file->fd_old = open(file->filename, O_RDONLY); // creating a place for the old stdout fd (shell)
00151   dup2(1, file->fd_old);  // backing up old fd pointed to by stdout (1 = stdout) 
00152   dup2(file->fd_temp, 1); // changing the fd pointed to by stdout 
00153   // stdout points now to the fd of our temp file
00154 }

bool end_paging ( pagerInfo file  ) 

Definition at line 157 of file lsh.cc.

Referenced by main().

00157                                 {
00158   dup2(file->fd_old, 1); // resetting the fd pointed to by stdout
00159 
00160   // stdout points to the shell's fd again
00161   close(file->fd_temp);
00162   close(file->fd_old); // removes the fd (the file stays open as stdout points to it too)
00163 
00164   string lessCommand = pager;
00165   lessCommand.append(" ");
00166   lessCommand.append(file->filename);
00167 
00168   int res = system(lessCommand.c_str());
00169   
00170   if (!(file->save)) {
00171     remove (file->filename);
00172   }
00173   
00174   return !res; // system returns 0 on success, but 0 is evaluated to false
00175 }

void simplePrintCol ( LCCollection *  col  ) 

PRINT FUNCITONS

Definition at line 186 of file lsh.cc.

Referenced by fun_print().

00186                                        {
00187   int nElements;
00188   const std::string colType = col->getTypeName();
00189   
00190   SimTrackerHit *trackerHit;
00191   SimCalorimeterHit *calHit;
00192   
00193   
00194   cout << "elements:   " << (nElements = col->getNumberOfElements()) << endl;
00195   if (colType == LCIO::SIMTRACKERHIT ) {
00196     cout << " Hit \tCell"<< endl;
00197     for (int i=0; i<nElements; i++) {
00198       trackerHit =  dynamic_cast<SimTrackerHit*> ( col->getElementAt(i) );
00199       cout << setw(4) << i << "\t" << setw(10) << trackerHit->getCellID() << endl;
00200     }
00201   } else if (colType == LCIO::SIMCALORIMETERHIT ) {
00202     cout << " Hit \tCell      \tEnergy" << endl;
00203     for (int i=0; i<nElements; i++) {
00204       calHit =  dynamic_cast<SimCalorimeterHit*> ( col->getElementAt(i) );
00205       cout << setw(4) << i << "\t" << setw(10) << calHit->getCellID0() << "\t" << setw(6) << calHit->getEnergy() << endl;
00206     }
00207   }
00208 }

void normalPrintCol ( LCCollection *  col  ) 

Definition at line 213 of file lsh.cc.

Referenced by fun_print().

00213                                        {
00214   if( col->getTypeName() == LCIO::MCPARTICLE ){
00215     LCTOOLS::printMCParticles( col ) ;
00216 
00217   }
00218   else if( col->getTypeName() == LCIO::SIMTRACKERHIT ){
00219           
00220     LCTOOLS::printSimTrackerHits( col ) ;
00221 
00222   }
00223   else if( col->getTypeName() == LCIO::TPCHIT ){
00224           
00225     LCTOOLS::printTPCHits( col ) ;
00226 
00227   }
00228   else if( col->getTypeName() == LCIO::TRACKERHIT ){
00229           
00230     LCTOOLS::printTrackerHits( col ) ;
00231 
00232   }
00233   else if( col->getTypeName() == LCIO::SIMCALORIMETERHIT ){
00234           
00235     LCTOOLS::printSimCalorimeterHits( col ) ;
00236 
00237   }
00238   else if( col->getTypeName() == LCIO::CALORIMETERHIT ){
00239           
00240     LCTOOLS::printCalorimeterHits( col ) ;
00241 
00242   }
00243   else if( col->getTypeName() == LCIO::RAWCALORIMETERHIT ){
00244           
00245     LCTOOLS::printRawCalorimeterHits( col ) ;
00246 
00247   }
00248   else if( col->getTypeName() == LCIO::LCFLOATVEC ){
00249           
00250     LCTOOLS::printLCFloatVecs( col ) ;
00251 
00252   }
00253   else if( col->getTypeName() == LCIO::LCINTVEC ){
00254           
00255     LCTOOLS::printLCIntVecs( col ) ;                               
00256 
00257   }
00258   else if( col->getTypeName() == LCIO::LCSTRVEC ){
00259           
00260     LCTOOLS::printLCStrVecs( col ) ;                                 
00261 
00262   }
00263   else if( col->getTypeName() == LCIO::TRACK ){
00264           
00265     LCTOOLS::printTracks( col ) ;
00266 
00267   }
00268   else if( col->getTypeName() == LCIO::CLUSTER ){
00269           
00270     LCTOOLS::printClusters( col ) ;
00271 
00272   }
00273   else if( col->getTypeName() == LCIO::RECONSTRUCTEDPARTICLE ){
00274           
00275     LCTOOLS::printReconstructedParticles( col ) ;
00276 
00277   }
00278   else if( col->getTypeName() == LCIO::VERTEX ){
00279           
00280     LCTOOLS::printVertices( col ) ;
00281 
00282   }
00283   else if( col->getTypeName() == LCIO::LCGENERICOBJECT ){
00284           
00285     LCTOOLS::printLCGenericObjects( col ) ;
00286 
00287   }
00288   else if( col->getTypeName() == LCIO::LCRELATION ){
00289           
00290     LCTOOLS::printRelation( col ) ;
00291   }
00292   else if( col->getTypeName() == LCIO::TRACKERRAWDATA ){
00293           
00294     LCTOOLS::printTrackerRawData( col ) ;
00295   }
00296   else if( col->getTypeName() == LCIO::TRACKERDATA ){
00297           
00298     LCTOOLS::printTrackerData( col ) ;
00299   }
00300   else if( col->getTypeName() == LCIO::TRACKERPULSE ){
00301           
00302     LCTOOLS::printTrackerPulse( col ) ;
00303   }
00304 }

void printTop (  ) 

Definition at line 309 of file lsh.cc.

Referenced by fun_ls(), and main().

00309                 {
00310   if (withEvents) {
00311     cout << mapRuns.size() << " Runs - " << numEvents << " Events" << endl;
00312   } else {
00313     cout << mapRuns.size() << " Runs - ?? Events" << endl;
00314   }
00315 }

void fun_print ( string  colNr,
string  flag 
)

Definition at line 320 of file lsh.cc.

Referenced by fun_dump(), fun_ls(), and main().

00320                                           {
00321   if ((position.size() < 3)) {
00322     return;
00323   }
00324   unsigned int c;
00325   istringstream i(colNr);
00326   i >> c;
00327   lcReader->open( position[TOP].second ) ;
00328   if ((event = lcReader->readEvent( position[RUN].first, position[EVT].first )) != 0) {
00329     const vector<string> *colVec = event->getCollectionNames();
00330     if (c < colVec->size()) {
00331       col = event->getCollection((*colVec)[c]);
00332       cout << "name:     " << (*colVec)[c] << endl;
00333       cout << "type:     " << col->getTypeName() << endl;
00334   
00335       if (flag == "-s") {
00336         simplePrintCol(col);
00337       } else {
00338         normalPrintCol(col);
00339       }
00340     }
00341   }
00342   
00343   lcReader->close() ;
00344 }

void lsRuns (  ) 

LS FUNCTIONS

Definition at line 357 of file lsh.cc.

Referenced by fun_ls().

00357               {
00358   map<int, string>::iterator it;
00359   map<int, string>::iterator itEnd = mapRuns.end();
00360   for( it = mapRuns.begin() ; it != itEnd ; it++ ) {
00361     if (withEvents) {
00362       stringstream sstream;
00363       sstream << "(" << mapEventsInRun[it->first] << " events)";
00364       string tempEvents = sstream.str() ;
00365       cout << "[" << setw(2) << it->first << "] " << left << setw(40) << it->second << "  " << right << setw(13) << tempEvents << endl; 
00366     } else {
00367       cout << "[" << setw(2) << it->first << "] " << left << setw(40) << it->second << "  " << endl;
00368     }
00369   }
00370 }

void lsEvents (  ) 

Definition at line 375 of file lsh.cc.

Referenced by fun_ls().

00375                 {
00376   lcReader->open( position[TOP].second ) ;
00377   while ( (event = lcReader->readNextEvent() ) != 0  && !interrupt) {
00378     if (event->getRunNumber() == (position[RUN].first)) {
00379       cout << "[" << setw(2) << event->getEventNumber() << "] " << setw(3) << (event->getCollectionNames())->size() << " Collections" << endl;
00380     }
00381   }
00382   interrupt = false;
00383   lcReader->close() ;
00384 }

void lsCollections (  ) 

Definition at line 389 of file lsh.cc.

Referenced by fun_ls().

00389                      {
00390   lcReader->open( position[TOP].second ) ;
00391   if ((event = lcReader->readEvent( position[RUN].first, position[EVT].first )) != 0) {
00392     const vector<string> *colVec = event->getCollectionNames();
00393     int i = 0;
00394     vector<string>::const_iterator it;
00395     vector<string>::const_iterator itEnd = colVec->end();
00396     for( it = colVec->begin(); it != itEnd ; it++ ){
00397       col = event->getCollection(*it);
00398       cout << "[" << setw(2) << i << "] " << left << setw(25) << *it << "  " << setw(20) << col->getTypeName() << "  " << right << setw(3) << col->getNumberOfElements () <<  endl;
00399       i++;
00400     }
00401   } else {
00402     cout << "this event does not exist" << endl;
00403   }
00404   lcReader->close() ;
00405 }

void fun_ls (  ) 

COMMAND FUNCTIONS

Definition at line 416 of file lsh.cc.

Referenced by main().

00416               {
00417   switch( position.size()-1 ){
00418     case TOP:
00419       printTop();
00420       lsRuns();
00421       break;
00422     case RUN:
00423       lsEvents();
00424       break;
00425     case EVT:
00426       lsCollections();
00427       break;
00428     case COL:
00429       string s; 
00430       stringstream n;
00431       n << position[COL].first;
00432       n >> s;
00433       fun_print(s, "-s");
00434       break;
00435   }
00436 }

void fun_cd ( string  str  ) 

Definition at line 441 of file lsh.cc.

Referenced by main().

00441                         {
00442   unsigned n;
00443   
00444   if (str.size() < 1) {
00445     return;
00446   }
00447   
00448   char *cstr, *p;
00449   cstr = new char [str.size()+1];
00450   strcpy (cstr, str.c_str());
00451   p=strtok (cstr,"/");
00452   while (p!=NULL)
00453   {
00454     string next; 
00455     stringstream sstream;
00456     sstream << p;
00457     sstream >> next;
00458     // moving up 
00459     if (next == "..") {
00460       if (position.size() == 1) {
00461         leave(0);
00462       }
00463       position.pop_back();
00464     } else {
00465       // moving into next level
00466       istringstream i(next);
00467       i >> n;
00468       switch( position.size()-1 ){
00469         case TOP:
00470           position.push_back(level(n, "/run_"+next));
00471           break;
00472         case RUN:
00473           position.push_back(level(n, "/evt_"+next));
00474           break;
00475         case EVT:
00476           lcReader->open( position[TOP].second ) ;
00477           if ((event = lcReader->readEvent( position[RUN].first, position[EVT].first )) != 0) {
00478             const vector<string> *colVec = event->getCollectionNames();
00479             if (n < colVec->size()) {
00480               position.push_back(level(n, "/"+(*colVec)[n] ));
00481             } else {
00482               cout << "No collection with number " << n << endl;
00483             }
00484           }
00485           lcReader->close();
00486           break;
00487       }
00488     }
00489   
00490     p=strtok(NULL,"/");
00491   }
00492 
00493   delete[] cstr;  
00494 
00495 }

void fun_dump ( string  arg  ) 

Definition at line 500 of file lsh.cc.

Referenced by main().

00500                           {
00501   switch( position.size()-1 ){
00502     case RUN:
00503       // WHY IS THERE NO readRunHeader( int run ) ??
00504       lcReader->open( position[TOP].second ) ;
00505       while (( runHdr = lcReader->readNextRunHeader() ) != 0 && !interrupt) {
00506         int run = runHdr->getRunNumber();
00507         if (run == position[RUN].first) {
00508           interrupt = true;
00509           LCTOOLS::dumpRunHeader(runHdr);
00510         }
00511       }
00512       lcReader->close() ;
00513       interrupt = false;
00514       break;
00515     case EVT:
00516       lcReader->open( position[TOP].second ) ;
00517       if ((event = lcReader->readEvent( position[RUN].first, position[EVT].first )) != 0) {
00518         if(arg == "-d"){
00519           LCTOOLS::dumpEventDetailed(event);
00520         } else {
00521           LCTOOLS::dumpEvent(event);
00522         }
00523       }
00524       lcReader->close() ;
00525       break;
00526     case COL:
00527       string s; 
00528       stringstream n;
00529       n << position[COL].first;
00530       n >> s;
00531       fun_print(s, "-d");
00532       break;
00533   }
00534 }

void fun_egg (  ) 

Definition at line 537 of file lsh.cc.

Referenced by main().

00537                {
00538   for (int i = 0; i < 4; i++ ) {
00539     cout << "Glugg...." << endl;
00540     sleep(1);
00541   }
00542   cout << "Ahhh\n" << endl;
00543 }

void fun_open ( string  filename  ) 

Definition at line 548 of file lsh.cc.

Referenced by main().

00548                                {
00549   position.clear();
00550   mapRuns.clear();
00551   mapEventsInRun.clear();
00552   
00553   FILE * pFile;
00554   long size;
00555 
00556   // checking file size, as we do not want to wait for 
00557   // the shell to map all the events of a large file.
00558   pFile = fopen (filename.c_str(),"rb");
00559   if (pFile==NULL) perror ("Error opening file");
00560   else
00561   {
00562     fseek (pFile, 0, SEEK_END);
00563     size= ftell(pFile);
00564     fclose (pFile);
00565     if (size > 50000000) {
00566       cout << "Large file: not preparing map of events in runs!" << endl;
00567       cout << "(Initialising will still take some time though." << endl;
00568       cout << " You can skip it using [ctrl]-[c].)" << endl;
00569       withEvents = false;
00570     }
00571   }
00572   
00573 
00574   egg.replace(1,2,2,'e');
00575   position.push_back(level(0, filename));
00576 
00577   lcReader->open( position[TOP].second ) ;
00578   while (( runHdr = lcReader->readNextRunHeader() ) != 0 && !interrupt) {
00579     int run = runHdr->getRunNumber();
00580     mapRuns.insert ( pair<int, string>(run, runHdr->getDescription()) );
00581     mapEventsInRun.insert( pair<int, int>(run, 0));
00582   }
00583   interrupt = false;
00584   lcReader->close() ;
00585   
00586   if (withEvents) {
00587     lcReader->open( position[TOP].second ) ;
00588     while ( (event = lcReader->readNextEvent()) != 0  && !interrupt) {
00589       (mapEventsInRun[event->getRunNumber()])++;
00590       numEvents++;
00591     }
00592     interrupt = false;
00593     lcReader->close() ;
00594   }
00595 }

void fun_help (  ) 

Definition at line 600 of file lsh.cc.

Referenced by main().

00600                 {
00601   cout << "  COMMANDS:" << endl;
00602   cout << "    cd | cl <number of OBJECT|..>    change into OBJECT | leave object; multiple levels can be given at once" << endl;
00603   cout << "                                        e.g.:   file.slcio/run1$ cd ../3/1" << endl;
00604   cout << "    ls                               list elements on next level | list content of active collection" << endl;
00605   cout << "    dump [-d]                        dump data of active level; -d triggers detailed dump of event" << endl;
00606   cout << "    print | cat [-s] <collection nr> print content of collection given; -s triggers short print-out" << endl;
00607   cout << endl;
00608   cout << "    open <filename>                  open new file" << endl;
00609   cout << "    exit | quit                      exit program" << endl;
00610   cout << "    help                             print this help text" << endl;
00611   cout << "    pager <command>                  use pager <command> when paging output" << endl;
00612   cout << endl;
00613   cout << "  REDIRECTION:" <<endl;
00614   cout << "    If '|' or '>' is appended to the a command, the output will be redirected to a file and then"<<endl;
00615   cout << "    displayed with the pager (see above)." << endl;
00616   cout << "    If a string is given after the redirect token, it is used as filename and the file is stored." <<endl;
00617   cout << "    (existing files will get overwritten without prompt). If no filename is given, a temporary " << endl;
00618   cout << "    file will be used for paging." << endl;
00619   cout << "       e.g.:    file.slcio/run1/evt1$ dump -d > event1.txt "<<endl;
00620 }

int main ( int  argc,
char **  argv 
)

MAIN

MAIN SHELL LOOP

read input

ohne readline

process input

Definition at line 634 of file lsh.cc.

00634                                  {
00635   string temp = egg;
00636   
00637   // Signal handlers
00638   signal(SIGINT, int_handler);
00639   signal(SIGTERM, term_handler);
00640   temp.push_back('r');
00641   
00642   
00643   // checking command and printing help if necessary
00644   if (argc != 2) {
00645     cout << "usage: lsh <file name>|-h" << endl;
00646     exit(1);
00647   }
00648   temp.insert(1,"b");
00649   if (!strcmp(argv[1], "-h")) {
00650     fun_help();
00651     exit(0);
00652   }
00653   temp.erase(0,1);
00654   
00655   
00656   // initialisation
00657   cout << setprecision(3) << fixed;
00658   lcReader = LCFactory::getInstance()->createLCReader() ;
00659   egg = temp;
00660   
00661   fun_open(argv[1]);         // opening new file and preparing general information
00662   printTop();
00663 
00664 
00665   
00666   /** MAIN SHELL LOOP */
00667   do {
00668 //     string commandBuf;
00669     vector<string> commandVec;
00670     
00671 
00672     /** read input */
00673 //    /** ohne readline **/
00674 //     if (!getline(cin, commandBuf)) {
00675 //       leave(0);
00676 //     }    
00677 //     if (!commandBuf.size()) {
00678 //       continue;
00679 //     }
00680 //     
00681 //     string buf;
00682 //     stringstream sstream(commandBuf);
00683 //     while (sstream >> buf) {
00684 //       commandVec.push_back(buf);
00685 //     }
00686     
00687     
00688     char *line = readline (print_prompt());
00689 
00690     // exit with CTRL+D
00691     if( line == '\0' ) {
00692         free(line);
00693         cout << "exit" << endl;
00694         leave(0);
00695     }
00696 
00697     if (!(line && *line)) {
00698       free(line);
00699       cout << endl;
00700       continue;
00701     }
00702     add_history(line);
00703     
00704     string buf;
00705     stringstream sstream(line);
00706     while (sstream >> buf) {
00707       commandVec.push_back(buf);
00708     }
00709     free(line);
00710 
00711     /** process input */
00712     // check if output should be paged
00713     pagerInfo data;
00714     data.save = false;
00715     
00716     int cvSize = commandVec.size();
00717     if (cvSize > 1) {
00718       // if redirect symbol end command, redirect to tmp-file
00719       if ((commandVec[cvSize-1] == "|") || (commandVec[cvSize-1] == ">")) {
00720         pageOutput = true;
00721         commandVec.pop_back();
00722       } else 
00723         // if redirect symbol is followed by a string, redirect to 
00724         // a file named according to this string 
00725         //(careful, file will be truncated without warning)
00726         if ((commandVec[cvSize-2] == "|") || (commandVec[cvSize-2] == ">")) {
00727         pageOutput = true; 
00728         data.save = true;
00729         strcpy(data.filename, commandVec[cvSize-1].c_str());
00730       }  
00731     }
00732     
00733     
00734     // if the output is paged, but paging failes, we want to 
00735     // run the command again, without paging 
00736     // in addition a message should be printed
00737     int run = 0;
00738     bool outputSuccess; 
00739     do {
00740       if (pageOutput) {
00741         begin_paging(&data);
00742       }
00743 
00744 
00745       // select action based on command given
00746       // -> improvement: move handling of parameters into functions and
00747       //                 pass pointer to commandVec instead of values
00748       if ((commandVec[0] == "exit") || (commandVec[0] == "quit")) { 
00749         leave(0); 
00750       }
00751       if (commandVec[0] == "ls") {
00752         fun_ls();
00753       }
00754       if ((commandVec[0] == "cl") || (commandVec[0] == "cd")) {
00755         fun_cd(commandVec[1]);
00756       }
00757       if ((commandVec[0] == "print") || (commandVec[0] == "cat")) {
00758         // add default output flag, if non was given
00759         if (commandVec.size() == 2) { 
00760           vector<string>::iterator it;
00761           it = ++(commandVec.begin());
00762           commandVec.insert ( it , "-d" );
00763         }
00764         fun_print(commandVec[2], commandVec[1]);
00765       }
00766       if ((commandVec[0] == "dump")) {
00767         if (commandVec.size() < 2) {
00768           commandVec.push_back("-s");
00769         }
00770         fun_dump(commandVec[1]);
00771       }
00772       if ((commandVec[0] == "open") || (commandVec[0] == "file")) {
00773         fun_open(commandVec[1]);
00774       }
00775       if ((commandVec[0] == egg)) {
00776         fun_egg(); 
00777       }
00778       if ((commandVec[0] == "help")) {
00779         fun_help();
00780       }
00781       if ((commandVec[0] == "pager")) {
00782         pager = commandVec[1];
00783       }
00784       if (!cin) { 
00785         leave(0);
00786       }
00787 
00788       if (pageOutput) {
00789         outputSuccess = end_paging(&data);
00790       } else {
00791         outputSuccess = true;
00792       } 
00793       pageOutput = false;
00794       ++run;
00795     } while (!outputSuccess); // repeat until output succesfully printed (max two runs)
00796     if (run != 1) {
00797       cout << "  paging failed - active pager: " << pager << endl;
00798       cout << "  You can set another pager with:  pager <command>" << endl;
00799     }
00800     
00801   } while (1 == 1);
00802 
00803 }


Variable Documentation

const int TOP = 0

Definition at line 59 of file lsh.cc.

Referenced by fun_cd(), fun_dump(), fun_ls(), fun_open(), fun_print(), lsCollections(), and lsEvents().

const int RUN = 1

Definition at line 60 of file lsh.cc.

Referenced by fun_cd(), fun_dump(), fun_ls(), fun_print(), lsCollections(), and lsEvents().

const int EVT = 2

Definition at line 61 of file lsh.cc.

Referenced by fun_cd(), fun_dump(), fun_ls(), fun_print(), and lsCollections().

const int COL = 3

Definition at line 62 of file lsh.cc.

Referenced by fun_dump(), and fun_ls().

vector<level> position

Definition at line 63 of file lsh.cc.

Referenced by fun_cd(), fun_dump(), fun_ls(), fun_open(), fun_print(), lsCollections(), lsEvents(), main(), and print_prompt().

map<int, string> mapRuns

Definition at line 65 of file lsh.cc.

Referenced by fun_open(), lsRuns(), and printTop().

map<int, int> mapEventsInRun

Definition at line 66 of file lsh.cc.

Referenced by fun_open(), and lsRuns().

int numEvents = 0

Definition at line 67 of file lsh.cc.

Referenced by fun_open(), and printTop().

bool withEvents = true

Definition at line 68 of file lsh.cc.

Referenced by fun_open(), lsRuns(), and printTop().

bool interrupt = false

Definition at line 69 of file lsh.cc.

Referenced by fun_dump(), fun_open(), int_handler(), and lsEvents().

bool pageOutput = false

Definition at line 70 of file lsh.cc.

Referenced by main().

string pager = "less"

Definition at line 72 of file lsh.cc.

Referenced by end_paging(), and main().

string egg = "egg"

Definition at line 73 of file lsh.cc.

Referenced by fun_open(), and main().

LCReader* lcReader

Definition at line 76 of file lsh.cc.

Referenced by anajob(), fun_cd(), fun_dump(), fun_open(), fun_print(), lcrdrclose(), lcrdrcreate(), lcrdrdelete(), lcrdreventprocessor(), lcrdropen(), lcrdropenchain(), lcrdrreadstream(), lcreadnextrunheader(), leave(), lsCollections(), lsEvents(), main(), writeEventTree(), and writeTree().

LCRunHeader* runHdr

Definition at line 77 of file lsh.cc.

Referenced by fun_dump(), fun_open(), lcreadnextrunheader(), lcwriterunheader(), and main().

LCEvent* event

Definition at line 78 of file lsh.cc.

Referenced by UTIL::lStdHep::alphaQCD(), UTIL::lStdHep::alphaQED(), UTIL::lStdHep::blockId(), UTIL::lStdHep::colorflow(), UTIL::lStdHep::daughter1(), UTIL::lStdHep::daughter2(), MicrorocMergeReader::decodeData(), UTIL::lStdHep::E(), UTIL::lStdHep::eventweight(), UTIL::lStdHep::evtNum(), fun_cd(), fun_dump(), fun_open(), fun_print(), MicrorocOldLabviewReader::getAcqData(), MicrorocMergeReader::getAcqData(), Hardroc2XdaqReader::getAcqData(), Hardroc2LabviewReader::getAcqData(), Hardroc1Reader::getAcqData(), DifSynchroReader::getAcqData(), MicrorocOldLabviewReader::getAnalogData(), TestMicrorocParser::getNextEvent(), MicrorocXDaqReader::getNextEvent(), MicrorocOldLabviewReader::getNextEvent(), MicrorocLabviewReader::getNextEvent(), Hardroc2XdaqReader::getNextEvent(), Hardroc2LabviewReader::getNextEvent(), Hardroc1Reader::getNextEvent(), DiracReader::getNextEvent(), DiracLabview::getNextEvent(), DifSynchroReader::getNextEvent(), Centaure::getNextEvent(), CalibMicrorocParser::getNextEvent(), CalibHR2Parser::getNextEvent(), CalibHR1Parser::getNextEvent(), UTIL::lStdHep::idrup(), UTIL::lStdHep::isStdHepEv4(), lcevtcreate(), lsCollections(), lsEvents(), UTIL::lStdHep::M(), main(), UTIL::lStdHep::mother1(), UTIL::lStdHep::mother2(), MicrorocReader::newHit(), Hardroc2Reader::newHit(), Hardroc1Reader::newHit(), DiracReader::newHit(), CalibMicrorocParser::newHit(), CalibHR2Parser::newHit(), CalibHR1Parser::newHit(), UTIL::lStdHep::nTracks(), UTIL::lStdHep::pid(), UTIL::lStdHep::Px(), UTIL::lStdHep::Py(), UTIL::lStdHep::Pz(), UTIL::lStdHep::runNum(), UTIL::lStdHep::scale(), UTIL::lStdHep::setDaughter1(), UTIL::lStdHep::setDaughter2(), UTIL::lStdHep::setE(), UTIL::lStdHep::setEvtNum(), UTIL::lStdHep::setM(), UTIL::lStdHep::setMother1(), UTIL::lStdHep::setMother2(), UTIL::lStdHep::setNTracks(), UTIL::lStdHep::setPid(), UTIL::lStdHep::setPx(), UTIL::lStdHep::setPy(), UTIL::lStdHep::setPz(), UTIL::lStdHep::setStatus(), UTIL::lStdHep::setT(), UTIL::lStdHep::setX(), UTIL::lStdHep::setY(), UTIL::lStdHep::setZ(), UTIL::lStdHep::spinX(), UTIL::lStdHep::spinY(), UTIL::lStdHep::spinZ(), UTIL::lStdHep::status(), DiracReader::storeHits(), UTIL::lStdHep::T(), UTIL::lStdHep::X(), UTIL::lStdHep::Y(), and UTIL::lStdHep::Z().

LCCollection* col

Definition at line 79 of file lsh.cc.

Referenced by fun_print(), MicrorocOldLabviewReader::getAcqData(), MicrorocMergeReader::getAcqData(), MicrorocOldLabviewReader::getAnalogData(), MicrorocXDaqReader::getNextEvent(), GassiplexBoardStrip::init(), GassiplexBoardBeta24::init(), GassiplexBoardBeta21::init(), lccoladdelement(), lccolcreate(), lccoldelete(), lccolgetelementat(), lccolgetflag(), lccolgetnumberofelements(), lccolgettypename(), lccolisdefault(), lccolistransient(), lccolremoveelementat(), lccolsetdefault(), lccolsetflag(), lccolsettransient(), lcevtaddcollection(), lcgetparameters(), lcrnvcreatecollection(), lcrnvcreatefromcollection(), lcsetparameters(), lsCollections(), main(), UTIL::operator<<(), readEventTree(), and writeTree().


Generated on Mon Jan 7 13:16:41 2013 for MicromegasFramework by  doxygen 1.4.7