StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rdMuDst2print.C
1 class StChain;
3 StChain *chain=0;
4 
5 
6 int rdMuDst2print(
7  char* file = "R50530.MuDst.root",
8  Int_t nFiles = 1,
9  char* inDir = "./",
10  int nEve=100)
11 {
12 
13  //file = "R5086033e.MuDst.root";
14  file = "R5015034x.MuDst.root";
15 
16  inDir = "/star/data05/scratch/balewski/outProd/R5086037/";
17  file="st_physics_5086037_raw_4040001-1*.MuDst.root";
18 
19 
20  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
21  loadSharedLibraries();
22  cout << " loading done " << endl;
23 
24 
25 // create chain
26  chain = new StChain("StChain");
27 
28 // Now we add Makers to the chain...
29  muMk = new StMuDstMaker(0,0,inDir,file,"MuDst.root",nFiles);
30 
31  chain->Init();
32  chain->ls(3);
33 
34  int eventCounter=0;
35  int stat=0;
36 
37  //---------------------------------------------------
38  while ( stat==0 ) {// loop over events
39  if(eventCounter>=nEve) break;
40  chain->Clear();
41  stat = chain->Make();
42 
43  // Access to muDst .......................
44  StMuEvent* muEve = muMk->muDst()->event();
45  int nPrim = muMk->muDst()->primaryTracks()->GetEntries(); // get number of primary tracks
46  StEventInfo &info=muEve->eventInfo();
47 
48 
49  printf("\n\n ====================%d processing eventID %d nPrim=%d ==============\n", eventCounter++,info.id(),nPrim);
50 
51  StMuEmcCollection* emc = muMk->muDst()->muEmcCollection();
52  if (!emc) {
53  printf(" No EMC data for this event\n");
54  return kStOK;
55  }
56  // printEEtower(emc);
57  // printEEpre(emc);
58  // printEEsmd(emc);
59 
60  }
61 
62 }
63 
64 //===========================================
65 //===========================================
66 printEEtower( StMuEmcCollection* emc ) {
67  int sec,eta,sub,adc;
68  StMuEmcHit *hit;
69 
70  int i, nh;
71 
72  printf("\Total %d hits in Tower (only ADC>0)\n",emc->getNEndcapTowerADC());
73  nh=0;
74  for (i=0; i< emc->getNEndcapTowerADC(); i++) {
75  emc->getEndcapTowerADC(i,adc,sec,sub,eta);
76  if (adc<=0) continue; // print only non-zero values
77  nh++;
78  printf("i=%d Tower %2.2dT%c%2.2d adc=%4d\n",i,sec,sub+'A'-1,eta,adc );
79  // printf(" Tower isec=%d ieta=%d isub=%d adc=%4d\n",sec,eta, sub,adc );
80  int adcX=1000+ (eta-1) + (sub-1)*12 +(sec-1)*60;
81  // assert(adc==adcX );
82 }
83  printf(" Total %d towers with ADC>0\n",nh);
84 }
85 
86 
87 //===========================================
88 //===========================================
89 printEEpre( StMuEmcCollection* emc ) {
90  int sec,eta,sub,pre,adc;
91  StMuEmcHit *hit;
92 
93  int i, nh;
94  nh= emc->getNEndcapPrsHits();
95  printf("\nTotal %d hits in pre1+2+post\n",nh);
96  for (i=0; i<nh; i++) {
97  hit=emc->getEndcapPrsHit(i,sec,sub,eta,pre);
98  int ss=sub + 5*(pre-1);
99  adc=hit->getAdc();
100  printf("i=%d pre/post(%d) %2.2d%c%c%2.2d : energy=%f adc=%d\n",i,pre,sec,pre+'P'-1,sub+'A'-1,eta,hit->getEnergy(),adc);
101  int adcX= (eta-1) + (sub-1) *12 +(sec-1)*60 + 1000*pre;
102 
103  // assert(adc==adcX );
104 
105  }
106 }
107 
108 
109 //===========================================
110 //===========================================
111 printEEsmd( StMuEmcCollection* emc ) {
112  int sec,strip,adc;
113  char uv='U';
114 
115  for(uv='U'; uv<='V'; uv++) {
116  int nh= emc->getNEndcapSmdHits(uv);
117  printf("\nTotal %d hits in SMD-%c\n",nh,uv);
118  for (int i=0; i<nh; i++) {
119  hit=emc->getEndcapSmdHit(uv,i,sec,strip);
120  adc=hit->getAdc();
121  printf(" SMD-%c %2.2d%c%3.3d : energy=%f adc=%d\n",uv,sec,uv,strip,hit->getEnergy(),adc);
122  int adcX= 1000 + strip-1 +(sec-1)*300;
123  // assert(adc==adcX );
124  }
125  }
126 }
float getEnergy() const
Return Hit energy.
Definition: StMuEmcHit.h:21
StMuDst * muDst()
Definition: StMuDstMaker.h:425
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
int getAdc() const
Return ADC value.
Definition: StMuEmcHit.h:19
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
virtual Int_t Make()
Definition: StChain.cxx:110
static StMuEmcCollection * muEmcCollection()
returns pointer to current StMuEmcCollection
Definition: StMuDst.h:389
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
Definition: Stypes.h:40