StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ttm.C
1 // example macro to use EEmcTTMMaker
2 // Author: Piotr A. Zolnierczuk, IUCF
3 // Date: 05/04/2004
4 //
5 
6 // ROOT/ROOT4STAR
7 class StChain;
8 class StMuTrack;
9 class StMuDstMaker;
10 class StEventInfo;
11 // TTM STUFF
12 class EEmcTower;
13 class EEmcTTMatch;
14 class EEmcTTMMaker;
15 
16 StChain *chain = 0;
17 EEmcTTMMaker *ttmMk = 0;
18 StMuDstMaker *muDstMk= 0;
19 
20 void
21 ttm
22 (
23  char* inpDir = "", // MuDST directory
24  char* inpFile = "ttm.lis", // MuDST file(s);
25  char* outFile = "ttm.ndst.root",// output nano dst root file
26  Int_t nFiles = 150, // # of MuDST file(s)
27  Int_t nEvents = -1 // # of events
28  )
29  // NOTES:
30  // 1. StEEmcDbMaker has some limitations so beware of the following
31  // ( complaints to appropriate autors)
32  // * StEEmcDbMaker works _only_ for single run , so make sure that
33  // your *.lis containf files for one run only, otherwise it will crash
34  // like Windoza
35 // not true anymore - OG
36  // 2. EEmcTTMMaker main "product" is a list of EEmcTTMatch'es which in turn
37  // are EEmcTower plus a list of StMuTrack's that fullfill certain criteria.
38 {
39  // load root/root4star libraries
40  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
41  loadSharedLibraries();
42  // load more libraries :)
43  gSystem->Load("libmysqlclient");
44  gSystem->Load("StDbLib");
45  gSystem->Load("StDbBroker");
46  gSystem->Load("St_db_Maker");
47  // load even more libraries (EEMC stuff)
48  gSystem->Load("StEEmcUtil");
49  gSystem->Load("StEEmcDbMaker");
50  gSystem->Load("StEEmcPoolTTM");
51 
52  // turn on profiling
53  //gSystem->Setenv("JPROF_FLAGS", "JP_START JP_PERIOD=0.001");
54  //gSystem->Load("libJprof");
55  // % jprof `which root4star` jprof-log >jprof.html
56 
57  // create the chain
58  chain = new StChain("StChain");
59 
60  // now we add Makers to the chain... some of that is black magic to me :)
61  muDstMk = new StMuDstMaker(0,0,inpDir,inpFile,"",nFiles); // main chain
62  StMuDbReader *db = StMuDbReader::instance(); // the database
63  St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb"); // more?
64  StEEmcDbMaker *eemcDbMk = new StEEmcDbMaker("eemcDb"); // EEMC database
65 
66 
67  // finally after so many lines we arrive at the good stuff
68  ttmMk = new EEmcTTMMaker ("TTM",muDstMk,eemcDbMk);
69  ttmMk->SetFileName(outFile); // output nanoDst file
70  // have cuts your way (optional)
71  ttmMk->SetMaxCTBSum(1000);
72  ttmMk->SetMinTrackLength(20.0);
73  ttmMk->SetMinTrackHits(5);
74  ttmMk->SetMinTrackPt(0.5);
75  ttmMk->SetMinTrackEta(0.7);
76  ttmMk->SetMaxTrackEta(2.2);
77  ttmMk->SetDeltaEtaCut(0.7); // ! note this is a fraction of tower width in eta
78  ttmMk->SetDeltaPhiCut(0.7); // ! note this is a fraction of tower width in phi
79  ttmMk->Summary(cout); // prints cut summary
80 
82  chain->Init();
83  chain->ls(3);
84 
85  // now comment in/out/change the below if you want it your way
86  StEEmcDb *eemcDb = (StEEmcDb*)chain->GetDataSet("StEEmcDb");
87  eemcDb->setPreferedFlavor("onlped","eemcPMTped"); // alternative flavor
88 
89  //---------------------------------------------------
90  int stat = 0;
91  int event= 0;
92  while(++event<=nEvents || nEvents<0) {
93  stat=chain->Make();
94  // STAR intelligence: stat=2 EOF,stat=4 FATAL; if so break the loop
95  // if not OK (and not EOF nor FATAL) !!! try another event
96  if( stat==2 || stat==4) break;
97  if( stat!=0 ) continue;
98  if(event%10 == 0 ) {
99  cerr << "event " << event << " \r";
100  cerr.flush();
101  }
102  }
103  cerr << endl;
104  ttmMk->Summary(cout);
105 }
106 
107 
void SetDeltaEtaCut(Double_t v=1.0)
sets delta eta cut see matchparams
Definition: EEmcTTMMaker.h:127
void SetMinTrackPt(Double_t v)
sets minimum track pT required
Definition: EEmcTTMMaker.h:106
class EEmcTTMMaker
Definition: EEmcTTMMaker.h:40
void SetMinTrackEta(Double_t v)
sets minimum pseudorapidity at the origin required
Definition: EEmcTTMMaker.h:111
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
EEmcTTMMaker(const char *self="ttmmk", class StMuDstMaker *mumaker=NULL)
ostream & Summary(ostream &out) const
prints matching cuts and statistics summary
void SetMaxTrackEta(Double_t v)
sets minimum pseudorapidity at the origin required
Definition: EEmcTTMMaker.h:116
void SetMinTrackLength(Double_t v)
sets minimum track length required
Definition: EEmcTTMMaker.h:101
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
void SetDeltaPhiCut(Double_t v=1.0)
sets delta phi cut see matchparams
Definition: EEmcTTMMaker.h:122
void SetMaxCTBSum(Int_t v)
sets maximum CTB sum allowed
Definition: EEmcTTMMaker.h:89
virtual Int_t Make()
Definition: StChain.cxx:110
EEmcTTMatch class contains results of TPC track to EEMC tower matching.
Definition: EEmcTTMatch.h:22
void SetMinTrackHits(Int_t v)
sets minimum number of hits/track required
Definition: EEmcTTMMaker.h:95
void SetFileName(const char *string)
set output file name
Definition: EEmcTTMMaker.h:130
EEmcTower holds information about an EEMC tower &#39;hit&#39;.
Definition: EEmcTower.h:17