StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runStEEmcPointTreeMaker.C
1 #define MONTE_CARLO
2 
3 class StChain;
5 
6 class St_db_Maker;
7 class StEEmcDb;
8 class StMuDstMaker;
9 class StEventMaker;
10 
11 class StEEmcA2EMaker;
12 class StEEmcClusterMaker;
13 
14 StChain *mChain = 0;
15 St_db_Maker *mStarDatabase = 0;
16 StEEmcDb *mEEmcDatabase = 0;
17 StMuDstMaker *mMuDstMaker = 0;
18 StEventMaker *mStEventMaker = 0;
19 
21 StEEmcClusterMaker *mEEclusters=0;
22 
23 void runStEEmcPointTreeMaker( Int_t nevents = 500,
24  Char_t *name = "mc_06TC02_eemc_2500_1_pt10.event.root",
25  Char_t *ofile = "mc_06TC02_eemc_2500_1_pt10.mix.root",
26  Char_t *ttree = "",
27  Char_t *path = "/star/data04/sim/jwebb/MonteCarlo/TowerScan/",
28  Int_t nfiles = 100,
29  Bool_t useSlow=1
30  )
31 {
32 
33  // Processes muDst's through the EEmcAnalysis Maker and produces
34  // some example histograms
35 
36  TString pathname = path;
37  pathname += name;
38 
39  //-- Load muDst shared libraries --
40  gROOT -> LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
41  loadSharedLibraries();
42 
43  //-- Load shared libraries specific to this analysis --
44  gROOT->LoadMacro("StRoot/StEEmcPool/StMaxStripPi0/macros/loadlibs.C");
45  loadlibs();
46 
47  //-- Create the analysis chain --
48  mChain = new StChain("eemcAnalysisChain");
49 
50  //-- Create IO maker
51  StIOMaker* ioMaker = new StIOMaker();
52  ioMaker->SetFile( pathname );
53  ioMaker->SetIOMode("r");
54  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
55  ioMaker->SetBranch("eventBranch",0,"r"); //activate Event Branch
56 
57 
58  //-- Initialize database connection --
59  mStarDatabase = new St_db_Maker("StarDb", "MySQL:StarDb");
60 
61  //-- DATE TIME FOR MONTE CARLO --
62 #ifdef MONTE_CARLO // flags for M-C events
63  TDatime *time = new TDatime();
64  mStarDatabase -> SetDateTime( time -> GetDate(), time -> GetTime() );
65  mStarDatabase->SetDateTime(20031120,0);
66  mStarDatabase->SetFlavor("sim","eemcPMTcal");
67  mStarDatabase->SetFlavor("sim","eemcPIXcal");
68  mStarDatabase->SetFlavor("sim","eemcPMTped");
69  mStarDatabase->SetFlavor("sim","eemcPMTstat");
70  mStarDatabase->SetFlavor("sim","eemcPMTname");
71  mStarDatabase->SetFlavor("sim","eemcADCconf");
72 #endif
73 
74  //-- Initialize EEMC database --
75  new StEEmcDbMaker("eemcDb");
76  std::cout << "mEEmcDatabase=" << mEEmcDatabase << std::endl;
77  gMessMgr -> SwitchOff("D");
78  gMessMgr -> SwitchOn("I");
79 
80  //-- Create the slow simulator for the endcap
81  /*
82  if ( useSlow ) {
83  StEEmcSlowMaker *slowSim = new StEEmcSlowMaker("slowSim");
84  slowSim->setDropBad(0); // 0=no action, 1=drop chn marked bad in db
85  slowSim->setAddPed(0); // 0=no action, 1=ped offset from db
86  slowSim->setSmearPed(0); // 0=no action, 1=gaussian ped, width from db
87  slowSim->setOverwrite(1); // 0=no action, 1=overwrite muDst values
88  }
89  */
90 
91  //-- The EEMC analysis maker --
92  mEEanalysis = new StEEmcA2EMaker("StEEmcA2EMaker");
93  mEEanalysis -> source("StEventMaker",2);
94  mEEanalysis -> database ( "eemcDb" );
95 
96 
97  mEEclusters=new StEEmcClusterMaker("StEEmcClusterMaker");
98  mEEclusters->analysis("StEEmcA2EMaker");
99  mEEclusters->setMaxExtent(3);
100  mEEclusters->setSeedFloor(2.5);
101  mEEclusters->setFillStEvent();
102 
103  //mEEpoints=new StEEmcPointMaker("mEEpoints");
104  mEEpoints=new StEEmcPointTreeMaker("mEEpoints");
105  mEEpoints->analysis("StEEmcA2EMaker");
106  mEEpoints->clusters("StEEmcClusterMaker");
107  mEEpoints->setFillStEvent();
108  mEEpoints->setFilename(ofile);
109 
110 
111 
112  mChain->ls(3);
113  mChain->Init();
114 
115 
116  //-- Loop over all events in the muDst --
117  Int_t stat = 0;
118  Int_t count = 0;
119 
120  while ( stat == 0 ) {
121 
122  //-- Terminate once we reach nevents --
123  if ( count++ >= nevents ) break;
124 
125  //-- Call clear on all makers --
126  mChain -> Clear();
127 
128  //-- Process the event through all makers --
129  stat = mChain -> Make();
130  if ( stat ) break;
131 
132  //-- Output so the user know we are still alive --
133  if ( !(count%1) ) {
134  std::cout << "Event = " << count << " ";
135  std::cout << "N hit = " << mEEanalysis -> numberOfHitTowers(0) << " ";
136  std::cout << "N cl = " << mEEclusters->numberOfClusters(5,0) << " "
137  << mEEclusters->numberOfClusters(5,1) << " "
138  << mEEclusters->numberOfClusters(5,2) << " "
139  << mEEclusters->numberOfClusters(5,3) << " "
140  << mEEclusters->numberOfSmdClusters(5,0) << " "
141  << mEEclusters->numberOfSmdClusters(5,1) << " ";
142  StEvent* mEvent = (StEvent*)mChain->GetInputDS("StEvent");
143  assert(mEvent);// fix your chain or open the right event file
144  StEmcCollection* emc =(StEmcCollection*)mEvent->emcCollection();
145  assert(emc);
146  StEmcDetector *tow=emc->detector(13);
147  StEmcDetector *pqr=emc->detector(14);
148  StEmcDetector *smdu=emc->detector(15);
149  StEmcDetector *smdv=emc->detector(16);
150  std::cout << "N stcl = " << " "
151  << tow->cluster()->numberOfClusters() << " "
152  << pqr->cluster()->numberOfClusters() << " "
153  << smdu->cluster()->numberOfClusters() << " "
154  << smdv->cluster()->numberOfClusters() << " ";
155  std::cout << std::endl;
156 
157 
158 
159  }
160 
161 
162 
163 
164 
165 
166  }
167 
168  //-- Finish up --
169  mChain -> Finish();
170 
171  return;
172 
173 
174 }
const StEEmcA2EMaker * mEEanalysis
ADC–&gt;E maker.
virtual void Clear(Option_t *opts="")
Clear clusters for next event.
void analysis(const Char_t *name)
Set the name of the ADC–&gt;E maker.
EEmc ADC –&gt; energy maker.
void setSeedFloor(Float_t f=2.0)
StEEmcClusterMaker(const Char_t *name="mEEclusters")
Int_t numberOfClusters(Int_t sec, Int_t layer) const
Return number of clusters for a given sector, layer.
Int_t numberOfSmdClusters(Int_t sec, Int_t plane) const
Return number of smd clusters for a given sector, plane.
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
void setMaxExtent(Int_t m)
Maximum distance around seed strip to cluster smd strips.
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Make clusters for this event.
virtual Int_t Finish()
Definition: StMaker.cxx:776
A cluster maker for the EEMC.