7 #include "TClonesArray.h"
14 #include "TStopwatch.h"
15 #include "TObjArray.h"
18 #include "AliPHOSHit.h"
19 #include "AliPHOSGetter.h"
20 #include "AliPHOSGeometry.h"
21 #include "AliPHOSDigit.h"
22 #include "AliPHOSSDigitizer.h"
23 #include "AliPHOSDigitizer.h"
24 #include "AliPHOSClusterizer.h"
25 #include "AliPHOSClusterizerv1.h"
26 #include "AliPHOSTrackSegmentMaker.h"
27 #include "AliPHOSTrackSegmentMakerv1.h"
28 #include "AliPHOSPID.h"
29 #include "AliPHOSPIDv1.h"
37 void write_info(TString) ;
40 //____________________________________________________________________________
44 Bool_t error = kFALSE ;
48 mess = "Examination ended successfully." ;
55 mess = "Beginning of the PHOS reconstruction." ;
58 mess = "SDigits process ended successfully." ;
67 mess = "Digits process ended successfully." ;
76 mess = "Cluster process ended successfully." ;
85 mess = "TrackSegments process ended successfully." ;
94 mess = "RecParticles process ended successfully." ;
102 mess = "reconstruction ended successfully." ;
106 gSystem->Exec("uuencode $ALICE_ROOT/PHOS/testPHOS.root testPHOS.root | mail -s 'PHOS INSTALLATION ERROR' almajor@caramail.com") ;
107 mess = "Error message to PHOS director has been sent, please wait for his answer before launching the whole simulation again." ;
113 //____________________________________________________________________________
117 // Definition of the alarm bounds for the examination
118 const Float_t maxAlaHitsM = 12.79 ; // total multiplicity
119 const Float_t maxAlaTotEn = 19.34 ; // total energy
120 const Float_t maxAlaTotEnB = 18.35 ; // per block multiplicity
121 const Float_t maxAlaHitsMB = 11.1 ; // per block energy
125 mess = "Beginning of the simulation examination." ;
128 // define the array in which the events that have not reach th EMCA will be put.
129 Bool_t error = kFALSE ;
134 // Get the number of events generated in the simulation
135 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
136 Int_t maxevent = gime->MaxEvent() ;
139 // Examine the alarms
140 TObjArray * alahm = dynamic_cast<TObjArray*>(gime->Alarms()->FindObject("HitsM")) ;
141 Float_t ratiohm = 100.0*static_cast<Float_t>(alahm->GetEntries())/static_cast<Float_t>(maxevent) ;
143 TObjArray * alaet = dynamic_cast<TObjArray*>(gime->Alarms()->FindObject("TotEn")) ;
144 Float_t ratioet = 100.0*static_cast<Float_t>(alaet->GetEntries())/static_cast<Float_t>(maxevent) ;
146 // Define the alarms per block and examine them
147 char namemul[80], namen[80] ;
148 TObjArray* alahmb[5] ;
149 TObjArray* alaenb[5] ;
150 Float_t ratiohmb[5], ratioenb[5] ;
153 for (i = 0 ; i < 5 ; i++){
154 sprintf(namemul,"HitsMB%d",i+1) ;
155 sprintf(namen,"TotEnB%d",i+1) ;
156 alahmb[i] = (TObjArray*) (gime->Alarms()->FindObject(namemul)) ;
157 ratiohmb[i] = 100.0*(Float_t)alahmb[i]->GetEntries()/(Float_t)maxevent ;
158 alaenb[i] = (TObjArray*)(gime->Alarms()->FindObject(namen)) ;
159 ratioenb[i] = 100.0*(Float_t)alaenb[i]->GetEntries()/(Float_t)maxevent ;
161 if (ratiohmb[i] > maxAlaHitsMB){
163 mess = "Examination detected an error in " + TString((const char *)namemul) ;
167 if (ratioenb[i] > maxAlaTotEnB) {
169 mess = "Examination detected an error in " + TString((const char *)namen) ;
179 if (ratiohm > maxAlaHitsM){
181 mess = "Examination detected an error in HitsM." ;
185 if (ratioet>maxAlaTotEn){
187 mess = "Examination detected an error in TotEn." ;
191 // Condition that will launch the general loop that builds the histograms in order to allow a further analysis.
196 mess = "Examination sets up the file that will be sent to PHOS director (30s)." ;
202 TH1F * his = new TH1F("Total Multiplicity", "Total Multiplicity in PHOS", 200, 0., 200.) ;
203 TH1F * hisnrg = new TH1F("Total Energy", "Total energy in PHOS", 200, 0., 12.) ;
205 // name and define the different histograms per block involved in the analysis
207 TClonesArray hisba("TH1F") ;
208 TClonesArray hisbanrg("TH1F") ;
211 char name[80], title[80] ;
212 for (i = 0 ; i < 6 ; i++) {
213 sprintf(name,"multiplicity for block %d",i) ;
214 sprintf(title,"multiplicity per blocks, block %d",i) ;
215 new(hisba[i]) TH1F(name, title, 100, 0., 100.) ;
217 sprintf(name,"total energy for block %d",i) ;
218 sprintf(title,"total energy per block, block %d",i) ;
219 new(hisbanrg[i]) TH1F(name, title, 200, 0., 12.) ;
222 // define the global histograms, the hit pointer and give the means to get the actual block reached by the photon
227 TH2F * hbiz = new TH2F ("hbiz","hbiz", 200, 0., 200., 200, 0., 12.) ;
228 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
230 // the very general loop
232 for (index = 0 ; index < maxevent ; index++) {
233 //get the number of the event
235 // get the number of cells reached during this event and fill the total multiplicity histogram
236 Int_t n = gime->Hits()->GetEntries() ;
239 // Get the data per block
240 TClonesArray * hita = static_cast<TClonesArray *>(gime -> Hits()) ;
243 Int_t id = 0, block = 0 ;
244 Int_t nhit[6], rid[4] ;
248 for ( i = 0; i < 6 ; i++) {
253 while ( (hit = static_cast<AliPHOSHit *>(next())) ) {
255 if (geom->IsInEMC(id) ) {
256 Et += ( hit -> GetEnergy()) ;
257 geom->AbsToRelNumbering(id,rid) ;
260 etblock[block] += ( hit -> GetEnergy()) ;
264 //Fill all the histograms but total multiplicity, already done
265 hist = static_cast<TH1F*>(hisba.At(block)) ;
266 hist->Fill(nhit[block]) ;
267 histnrg = static_cast<TH1F*>(hisbanrg.At(block)) ;
268 histnrg->Fill(etblock[block]) ;
273 TFile * file = gROOT -> GetFile("testPHOS.root") ;
281 //____________________________________________________________________________
286 const Float_t maxSDigits = 62.89 ;
287 const Float_t widSDigits = TMath::Sqrt(maxSDigits) ;
290 TString reconame = "test suite" ;
292 AliPHOSSDigitizer *sd = new AliPHOSSDigitizer("testPHOS.root",reconame.Data()) ;
293 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
295 sd->ExecuteTask("deb") ;
297 Float_t nSDigits = static_cast<Float_t>(gime->SDigitizer()->GetSDigitsInRun()) / static_cast<Float_t>(gime->MaxEvent()) ;
298 if ( nSDigits < maxSDigits-widSDigits ||
299 nSDigits > maxSDigits+widSDigits ) {
300 mess = "Error detected in the SDigits process. Sending error file to PHOS director." ;
309 //____________________________________________________________________________
314 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
315 TString reconame = "test suite" ;
316 const Float_t maxDigits = 3489.41 ;
317 const Float_t widDigits = TMath::Sqrt(maxDigits) ;
321 AliPHOSDigitizer *d = new AliPHOSDigitizer("testPHOS.root",reconame.Data()) ;
323 d->ExecuteTask("deb") ;
325 Float_t nDigits = static_cast<Float_t>(gime->Digitizer()->GetDigitsInRun()) / static_cast<Float_t>(gime->MaxEvent()) ;
327 if ( nDigits < maxDigits-widDigits || nDigits > maxDigits+widDigits ) {
328 mess = "Error detected in the Digits process. Sending error file to PHOS director." ;
337 //____________________________________________________________________________
342 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
343 TString reconame = "test suite" ;
345 const Float_t maxRecPoints = 222.83 ;
346 const Float_t widRecPoints = TMath::Sqrt(maxRecPoints) ;
350 AliPHOSClusterizer * cluster = new AliPHOSClusterizerv1("testPHOS.root", reconame.Data()) ;
352 cluster->ExecuteTask("deb") ;
354 Float_t nRecPoints = static_cast<Float_t>(gime->Clusterizer(reconame.Data())->GetRecPointsInRun()) /
355 static_cast<Float_t>(gime->MaxEvent()) ;
357 if ( nRecPoints < maxRecPoints-widRecPoints
358 || nRecPoints > maxRecPoints+widRecPoints ) {
359 mess = "Error detected in the Clusterizing process. Sending error file to PHOS director." ;
368 //____________________________________________________________________________
372 //TrackSegments process
373 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
374 const Float_t maxTrackSegments = 1 ;
377 TString reconame = "test suite" ;
379 AliPHOSTrackSegmentMaker * tracks = new AliPHOSTrackSegmentMakerv1("testPHOS.root",reconame.Data()) ;
381 tracks->ExecuteTask("deb") ;
383 Float_t nTrackSegments = static_cast<Float_t> (gime->TrackSegmentMaker(reconame.Data())->GetTrackSegmentsInRun()) /
384 static_cast<Float_t>(gime->MaxEvent()) ;
386 if ( nTrackSegments < maxTrackSegments-0.25 ||
387 nTrackSegments > maxTrackSegments+0.25 ) {
388 mess = "Error detected in the TrackSegments process. Sending error file to PHOS director." ;
397 //____________________________________________________________________________
401 //RecParticles process
402 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
403 const Float_t maxRecParticles = 1 ;
406 TString reconame = "test suite" ;
408 AliPHOSPID * pid = new AliPHOSPIDv1("testPHOS.root",reconame.Data()) ;
410 pid->ExecuteTask("deb") ;
412 Float_t nRecParticles = static_cast<Float_t> (gime->PID(reconame.Data())->GetRecParticlesInRun()) /
413 static_cast<Float_t>(gime->MaxEvent()) ;
416 if ( nRecParticles < maxRecParticles-0.25 ||
417 nRecParticles > maxRecParticles+0.25 ) {
418 mess = "Error detected in the RecParticles process. Sending error file to PHOS director.Stop reconstruction." ;
427 //____________________________________________________________________________
428 void write_info(TString mess)
430 cerr << " _____________________________________________________________ " << endl
432 << "MESS ==> " << mess <<endl
433 << " _____________________________________________________________ " <<endl ;