StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
minesweeper.C
1 //
2 // minesweeper.C
3 //
4 // Runs the EEmc tower-only cluster finder.
5 //
6 
7 
8 
9 void minesweeper( int nEve = 10,
10  char *file = "/star/data04/sim/MuDst/minbias_pp200_pythia6.203_2003_hadronicon_trsic/rcf1200_2576_2000evts.MuDst.root",
11  Int_t nFiles = 1,
12  char *inDir = "NONE",
13  char *dbFlavor = "NONE",
14  float scaleFactor = 1.0
15  ) {
16 
17  // Output an initial summary of what we're doing...
18  std::cout << "Running EEMC MineSweeper Cluster Finder" << std::endl;
19  std::cout << "Processing: " << nEve << " events" << std::endl;
20  std::cout << "Input file: " << file << std::endl;
21  std::cout << "DB Flavor: " << dbFlavor << std::endl;
22  std::cout << "scaleFactor: " << scaleFactor << std::endl;
23  std::cout << std::flush;
24 
25  // Load dynamic libraries
26  LoadLibs();
27 
28  // Create the Analysis Chain
29  chain = new StChain("StChain");
30 
31  // Some histograms for study, not compiled into our makers
32  TH1F *nclust = new TH1F("nclust","Number of clusters",10,0,10);
33 
34  // Now we add Makers to the chain...
35 
36 
37  // The cluster maker is designed to run on micro dst's rather
38  // than StEvent files. We initialize w/ default "MuDst" name...
39  std::cout << "Instantiating muDstMk: " << file << std::endl;
40  StMuDstMaker *muDstMk = new StMuDstMaker(0,0,"",file,"",nFiles);
41  StMuDbReader *muDb = StMuDbReader::instance();
42 
43  //
44  // Configure the database, based on user input. We default to
45  // "NONE" here, which will skip the database and (for the
46  // time being) the cluster maker defaults to idealized gains
47  // in use in the Monte Carlo.
48  //
49  if ( dbFlavor != "NONE" &&
50  dbFlavor != "none" ) {
51 
52  // Database Makers
53  St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
54  StEEmcDbMaker *myMk = new StEEmcDbMaker("eemcDb");
55  // Force a timestamp here, so as not to run afoul of an assert
56  dbMk -> setTimeStampDay(20030516);
57 
58  }
59 
60 
61  // Cluster maker
62  StMuEETowerClusterMaker
63  *muEEClusterMaker = new StMuEETowerClusterMaker("muEEClusterMaker","MuDst");
64  // Set seed threshold of 0.6 GeV, and a user specified "scale factor".
65  // The default on this is 1.0, but should be 0.8 for Monte Carlo events,
66  // as this is needed to reconstruct the pi0 mass in the Monte Carlo...
67  muEEClusterMaker -> setSeedThreshold(0.6);
68  muEEClusterMaker -> setScaleFactor(scaleFactor);
69 
70 
71  // Initialize the chain
72  chain->Init();
73  eemcDb = (StEEmcDb*)chain->GetDataSet("StEEmcDb");
74  // Only look at the bottom (aka "first") 1/3 of the endcap
75  eemcDb -> setSectors(5,8);
76  // Setup default flavor
77  eemcDb -> setPreferedFlavor( dbFlavor, "eemcPMTcal" );
78  chain->ls(3);
79 
80  int eventCounter=0;
81  int stat=0;
82 
83  //---------------------------------------------------
84  while ( stat==0 ) {// loop over events
85 
86  if(eventCounter>=nEve) break;
87  chain->Clear();
88 
89  std::cout << "Processing event number " << eventCounter << std::endl;
90  stat = chain->Make();
91 
92  // Fill histograms if you really want to
93  nclust -> Fill( muEEClusterMaker -> getNClusters() );
94 
95  // Print a summary of the cluster finder
96  muEEClusterMaker -> Print();
97 
98  eventCounter++;
99 
100  }
101 
102  // Tell us what happened if we terminated earlyx
103  if ( stat != 0 ) std::cout << "Loop terminated w/ stat = " << stat << std::endl;
104 
105 
107 
108 }
109 
110 
111 void LoadLibs() {
112 
113  std::cout << "Loading libraries" << std::endl;
114 
115  if (gClassTable->GetID("TTable") < 0)
116  gSystem->Load("libStar");
117  gSystem->Load("St_base");
118  gSystem->Load("StChain");
119  gSystem->Load("St_Tables");
120  gSystem->Load("StMagF");
121  gSystem->Load("StUtilities"); // new addition 22jul99
122  gSystem->Load("StTreeMaker");
123  gSystem->Load("StIOMaker");
124  gSystem->Load("StarClassLibrary");
125  gSystem->Load("StTpcDb");
126  gSystem->Load("StDbUtilities");
127  gSystem->Load("StEvent");
128  gSystem->Load("StEventUtilities");
129  gSystem->Load("StMcEvent");
130  gSystem->Load("StMcEventMaker");
131  gSystem->Load("StAssociationMaker");
132  gSystem->Load("StMcAnalysisMaker");
133  gSystem->Load("StStrangeMuDstMaker");
134  gSystem->Load("StDbLib");
135  gSystem->Load("StDbBroker");
136  gSystem->Load("St_db_Maker");
137  gSystem->Load("libgeometry_Tables");
138  gSystem->Load("StDaqLib");
139  gSystem->Load("StEmcUtil");
140  gSystem->Load("StEmcADCtoEMaker");
141  gSystem->Load("StPreEclMaker");
142  gSystem->Load("StEpcMaker");
143 
144  assert(gSystem->Load("StMuDSTMaker")==0);
145  assert(gSystem->Load("StEEmcUtil")==0);
146  assert(gSystem->Load("StEEmcPoolmuDst")==0 );
147  assert(gSystem->Load("StEEmcPoolTowerOnly")==0 );
148 
149 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Definition: StChain.cxx:110