1 #include "AliPHOSGetter.h"
7 #include "TClonesArray.h"
10 #include "AliPHOSHit.h"
14 #include "TStopwatch.h"
15 #include "TObjArray.h"
16 #include "AliPHOSGeometry.h"
21 void testsimexam (Int_t nevent=1, const char *config="testconfig.C")
24 // Simple macro to run aliroot in a batch mode
26 cerr<<" __________________________________________________________________ "<<endl;
28 cerr<<" MESS ==> Beginning of the simulation examination."<<endl;
29 cerr<<" __________________________________________________________________ "<<endl;
30 // Definition of the alarm bounds
31 const Float_t maxAlaHitsM = 12.79 ; // total multiplicity
32 const Float_t maxAlaTotEn = 19.34 ; // total energy
33 const Float_t maxAlaTotEnB = 18.35 ; // per block multiplicity
34 const Float_t maxAlaHitsMB = 11.1 ; // per block energy
36 // boolean which will test if there is an alarm
40 // define the array in which the events that have not reach th EMCA will be put.
47 // Get the number of events generated in the simulation
49 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("galice.root") ;
50 Int_t maxevent = gime->MaxEvent() ;
54 TObjArray * alahm = (TObjArray*)(gime->Alarms()->FindObject("HitsM"));
55 Float_t ratiohm = 100.0*(Float_t)alahm->GetEntries()/(Float_t)maxevent ;
58 TObjArray * alaet = (TObjArray*)(gime->Alarms()->FindObject("TotEn"));
59 Float_t ratioet = 100.0*(Float_t)alaet->GetEntries()/(Float_t)maxevent ;
62 // Define the alarms per block and examine them
63 char namemul[80], namen[80];
66 Float_t ratiohmb[5], ratioenb[5];
67 for (Int_t i = 0 ; i < 5 ; i++)
69 sprintf(namemul,"HitsMB%d",i+1);
70 sprintf(namen,"TotEnB%d",i+1);
71 alahmb[i] = (TObjArray*) (gime->Alarms()->FindObject(namemul));
72 ratiohmb[i] = 100.0*(Float_t)alahmb[i]->GetEntries()/(Float_t)maxevent;
73 alaenb[i] = (TObjArray*)(gime->Alarms()->FindObject(namen));
74 ratioenb[i] = 100.0*(Float_t)alaenb[i]->GetEntries()/(Float_t)maxevent;
75 if (ratiohmb[i]>maxAlaHitsMB){
77 cerr<<" _____________________________________________________________ "<<endl;
79 cerr << " MESS ==> Examination detected an error in "<<namemul << endl ;
80 cerr<<" _____________________________________________________________ "<<endl;
82 if (ratioenb[i]>maxAlaTotEnB) {
84 cerr<<" _____________________________________________________________ "<<endl;
86 cerr << " MESS ==> Examination detected an error in "<<namen << endl ;
87 cerr<<" _____________________________________________________________ "<<endl;
97 if (ratiohm>maxAlaHitsM){
99 cerr<<" _____________________________________________________________ "<<endl;
101 cerr << " MESS ==> Examination detected an error in HitsM." << endl ;
102 cerr<<" _____________________________________________________________ "<<endl;
105 if (ratioet>maxAlaTotEn){
107 cerr<<" _____________________________________________________________ "<<endl;
109 cerr << " MESS ==> Examination detected an error in TotEn." << endl ;
110 cerr<<" _____________________________________________________________ "<<endl;
114 // Condition that will launch the general loop that builds the histograms in order to allow a further analysis.
116 if ( boolala == 1 ) {
117 cerr<<" _____________________________________________________________ "<<endl;
119 cerr << " MESS ==> Examination sets up the file that will be sent to the responsible for PHOS in ALIROOT development (30s). " << endl ;
120 cerr<<" _____________________________________________________________ "<<endl;
124 TH1F * his = new TH1F("Total Multiplicity", "Total Multiplicity in PHOS", 200, 0., 200.) ;
125 TH1F * hisnrg = new TH1F("Total Energy", "Total energy in PHOS", 200, 0., 12.) ;
127 // name and define the different histograms per block involved in the analysis
128 TClonesArray hisba("TH1F") ;
129 TClonesArray hisbanrg("TH1F") ;
130 for (Int_t i = 0 ; i < 6 ; i++)
132 char name[80], title[80] ;
133 sprintf(name,"multiplicity for block %d",i) ;
134 sprintf(title,"multiplicity per blocks, block %d",i) ;
135 new(hisba[i]) TH1F(name, title, 100, 0., 100.) ;
138 char namenrg[80], titlenrg[80] ;
139 sprintf(namenrg,"total energy for block %d",i) ;
140 sprintf(titlenrg,"total energy per block, block %d",i) ;
141 new(hisbanrg[i]) TH1F(namenrg, titlenrg, 200, 0., 12.) ;
143 // define the global histograms, the hit pointer and give the means to get the actual block reached by the photon
147 TH2F * hbiz = new TH2F ("hbiz","hbiz",200.,0.,200.,200.,0.,12.);
148 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
151 // the very general loop
152 for (index = 0 ; index < maxevent ; index++)
154 //get the number of the event
156 // get the number of cells reached during this event and fill the total multiplicity histogram
157 Int_t n = gime->NHits() ;
160 // Get the data per block
161 TClonesArray * hita = (TClonesArray *) gime -> Hits();
164 Int_t id = 0, block = 0;
165 Int_t nhit[6], rid[4];
167 for ( Int_t i = 0; i < 6 ; i++) {
172 while ( (hit = (AliPHOSHit *) next()) ) {
174 if (geom->IsInEMC(id) ) {
175 Et += ( hit -> GetEnergy());
176 geom->AbsToRelNumbering(id,rid) ;
179 etblock[block] += ( hit -> GetEnergy());
184 //Fill all the histograms but total multiplicity, already done
185 hist = static_cast<TH1F*>(hisba.At(block)) ;
186 hist->Fill(nhit[block]) ;
187 histnrg = static_cast<TH1F*>(hisbanrg.At(block)) ;
188 histnrg->Fill(etblock[block]);
194 cerr << "av = " << nhits << endl ;
195 TFile * file = gROOT -> GetFile("galice.root");
201 //Put the histograms in the root file
202 for (Int_t i = 0 ; i < 6 ; i++) {
203 hist = static_cast<TH1F*>(hisba.At(i)) ;
204 histnrg = static_cast<TH1F*>(hisbanrg.At(i));
207 // cout << hist << endl << i << endl ;
218 gSystem->Exec("uuencode $ALICE_ROOT/PHOS/galice.root galice.root | mail -s 'PHOS INSTALLATION ERROR ' schutz@in2p3.fr");
221 cerr<<" _____________________________________________________________ "<<endl;
223 cerr << " MESS ==> Examination ended successfully. " << endl ;
224 cerr<<" _____________________________________________________________ "<<endl;