StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
exampleEmc.C
1 // This is an example of how to read the MuDst and do the clusterfinding
2 // for the BEMC
3 
4 void exampleEmc(const Char_t *infile="/star/data24/reco/production_dAu2008/ReversedFullField/P08ic/2008/026/9026032/st_physics_adc_9026032_raw_1070010.MuDst.root",const Int_t n_event=100) {
5  gROOT->Macro("loadMuDst.C");
6 
7  // Load St_db_Maker and co
8  gSystem->Load("StDbLib.so");
9  gSystem->Load("StDbBroker.so");
10  gSystem->Load("St_db_Maker");
11 
12  // Load Emc libraries
13  gSystem->Load("StDaqLib");
14  gSystem->Load("StEmcRawMaker");
15  gSystem->Load("StEmcADCtoEMaker");
16  gSystem->Load("StPreEclMaker");
17  gSystem->Load("StEpcMaker");
18 
19  StChain *chain=new StChain;
20  StMuDstMaker *mudst_mk=new StMuDstMaker(0,0,"",infile,"",999);
21 
22  // Need St_db_Maker for Emc calibration
23  St_db_Maker *db1 = new St_db_Maker("db","$HOME/StarDb","MySQL:StarDb","$STAR/StarDb");
24 
25  // Maker to apply calibration
26  StEmcADCtoEMaker *adc_to_e=new StEmcADCtoEMaker();
27  adc_to_e->setPrint(kFALSE);
28  // Makers for clusterfinding
29  StPreEclMaker *pre_ecl=new StPreEclMaker();
30  pre_ecl->setPrint(kFALSE);
31  StEpcMaker *epc=new StEpcMaker();
32  epc->setPrint(kFALSE);
33 
34  chain->Init();
35 
36  // This is how you can set alternative clustering parameters
37  /*
38  pre_ecl->SetClusterConditions("bemc", 4, 0.2, 0.1, 0.05, kFALSE);
39 
40  Int_t sizeMax = 5;
41  Float_t energySeed = 0.2;
42  Float_t energyAdd = 0.1;
43  Float_t minTotE = 0.05;
44 
45  pre_ecl->SetClusterConditions("bsmde", sizeMax,energySeed, energyAdd,
46  minTotE, kFALSE);
47  pre_ecl->SetClusterConditions("bsmdp", sizeMax,energySeed, energyAdd,
48  minTotE, kFALSE);
49  */
50 
51  Int_t i_event=0;
52  while (i_event < n_event && chain->Make() == kStOk) {
53 
54  StEmcCollection *emcCollection = mudst_mk->muDst()->emcCollection();
55 
56  if (emcCollection) {
57  cout << emcCollection->barrelPoints().size() << " points in barrel" << endl;
58 
59  StEmcDetector *barrel = emcCollection->detector(kBarrelEmcTowerId);
60  if (barrel->cluster())
61  cout << barrel->cluster()->clusters().size() << " barrel tower clusters" << endl;
62  StEmcDetector *smde = emcCollection->detector(kBarrelSmdEtaStripId);
63  if (barrel->cluster())
64  cout << smde->cluster()->clusters().size() << " smd eta clusters" << endl;
65  StEmcDetector *smdp = emcCollection->detector(kBarrelSmdPhiStripId);
66  if (barrel->cluster())
67  cout << smdp->cluster()->clusters().size() << " smd phi clusters" << endl;
68  }
69  else {
70  cout << "No emc collection!" << endl;
71  }
72 
73  i_event++;
74  chain->Clear();
75  }
76 }
StMuDst * muDst()
Definition: StMuDstMaker.h:425
void setPrint(Bool_t)
Obsolete function; users can control messages with logger config file.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setPrint(Bool_t a)
Obsolete function; users can control messages with logger config file.
Definition: StPreEclMaker.h:36
void setPrint(Bool_t a)
Obsolete function; users can control messages with logger config file.
Definition: StEpcMaker.h:89
static StEmcCollection * emcCollection()
returns pointer to current StEmcCollection
Definition: StMuDst.h:405
Definition: Stypes.h:41