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 gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I.");
45 Bool_t error = kFALSE ;
49 mess = "Examination ended successfully." ;
56 mess = "Beginning of the PHOS reconstruction." ;
59 mess = "SDigits process ended successfully." ;
68 mess = "Digits process ended successfully." ;
77 mess = "Cluster process ended successfully." ;
86 mess = "TrackSegments process ended successfully." ;
95 mess = "RecParticles process ended successfully." ;
103 mess = "reconstruction ended successfully." ;
107 gSystem->Exec("uuencode $ALICE_ROOT/PHOS/testPHOS.root testPHOS.root | mail -s 'PHOS INSTALLATION ERROR' schutz@in2p3.fr") ;
108 mess = "Error message to PHOS director has been sent, please wait for his answer before launching the whole simulation again." ;
114 //____________________________________________________________________________
118 // Definition of the alarm bounds for the examination
119 const Float_t maxAlaHitsM = 12.79 ; // total multiplicity
120 const Float_t maxAlaTotEn = 19.34 ; // total energy
121 const Float_t maxAlaTotEnB = 18.35 ; // per block multiplicity
122 const Float_t maxAlaHitsMB = 11.1 ; // per block energy
126 mess = "Beginning of the simulation examination." ;
129 // define the array in which the events that have not reach th EMCA will be put.
130 Bool_t error = kFALSE ;
135 // Get the number of events generated in the simulation
136 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
137 Int_t maxevent = gime->MaxEvent() ;
140 // Examine the alarms
141 TObjArray * alahm = dynamic_cast<TObjArray*>(gime->Alarms()->FindObject("HitsM")) ;
142 Float_t ratiohm = 100.0*static_cast<Float_t>(alahm->GetEntries())/static_cast<Float_t>(maxevent) ;
144 TObjArray * alaet = dynamic_cast<TObjArray*>(gime->Alarms()->FindObject("TotEn")) ;
145 Float_t ratioet = 100.0*static_cast<Float_t>(alaet->GetEntries())/static_cast<Float_t>(maxevent) ;
147 // Define the alarms per block and examine them
148 char namemul[80], namen[80] ;
149 TObjArray* alahmb[5] ;
150 TObjArray* alaenb[5] ;
151 Float_t ratiohmb[5], ratioenb[5] ;
154 for (i = 0 ; i < 5 ; i++){
155 sprintf(namemul,"HitsMB%d",i+1) ;
156 sprintf(namen,"TotEnB%d",i+1) ;
157 alahmb[i] = (TObjArray*) (gime->Alarms()->FindObject(namemul)) ;
158 ratiohmb[i] = 100.0*(Float_t)alahmb[i]->GetEntries()/(Float_t)maxevent ;
159 alaenb[i] = (TObjArray*)(gime->Alarms()->FindObject(namen)) ;
160 ratioenb[i] = 100.0*(Float_t)alaenb[i]->GetEntries()/(Float_t)maxevent ;
162 if (ratiohmb[i] > maxAlaHitsMB){
164 mess = "Examination detected an error in " + TString(namemul) ;
168 if (ratioenb[i] > maxAlaTotEnB) {
170 mess = "Examination detected an error in " + TString(namen) ;
180 if (ratiohm > maxAlaHitsM){
182 mess = "Examination detected an error in HitsM." ;
186 if (ratioet>maxAlaTotEn){
188 mess = "Examination detected an error in TotEn." ;
192 // Condition that will launch the general loop that builds the histograms in order to allow a further analysis.
197 mess = "Examination sets up the file that will be sent to PHOS director (30s)." ;
203 TH1F * his = new TH1F("Total Multiplicity", "Total Multiplicity in PHOS", 200, 0., 200.) ;
204 TH1F * hisnrg = new TH1F("Total Energy", "Total energy in PHOS", 200, 0., 12.) ;
206 // name and define the different histograms per block involved in the analysis
208 TClonesArray hisba("TH1F") ;
209 TClonesArray hisbanrg("TH1F") ;
212 char name[80], title[80] ;
213 for (i = 0 ; i < 6 ; i++) {
214 sprintf(name,"multiplicity for block %d",i) ;
215 sprintf(title,"multiplicity per blocks, block %d",i) ;
216 new(hisba[i]) TH1F(name, title, 100, 0., 100.) ;
218 sprintf(name,"total energy for block %d",i) ;
219 sprintf(title,"total energy per block, block %d",i) ;
220 new(hisbanrg[i]) TH1F(name, title, 200, 0., 12.) ;
223 // define the global histograms, the hit pointer and give the means to get the actual block reached by the photon
228 TH2F * hbiz = new TH2F ("hbiz","hbiz", 200, 0., 200., 200, 0., 12.) ;
229 const AliPHOSGeometry * geom = gime->PHOSGeometry() ;
231 // the very general loop
233 for (index = 0 ; index < maxevent ; index++) {
234 //get the number of the event
236 // get the number of cells reached during this event and fill the total multiplicity histogram
237 Int_t n = gime->Hits()->GetEntries() ;
240 // Get the data per block
241 const TClonesArray * hita = static_cast<const TClonesArray *>(gime -> Hits()) ;
244 Int_t id = 0, block = 0 ;
245 Int_t nhit[6], rid[4] ;
249 for ( i = 0; i < 6 ; i++) {
254 while ( (hit = static_cast<AliPHOSHit *>(next())) ) {
256 if (geom->IsInEMC(id) ) {
257 Et += ( hit -> GetEnergy()) ;
258 geom->AbsToRelNumbering(id,rid) ;
261 etblock[block] += ( hit -> GetEnergy()) ;
265 //Fill all the histograms but total multiplicity, already done
266 hist = static_cast<TH1F*>(hisba.At(block)) ;
267 hist->Fill(nhit[block]) ;
268 histnrg = static_cast<TH1F*>(hisbanrg.At(block)) ;
269 histnrg->Fill(etblock[block]) ;
274 TFile * file = gROOT -> GetFile("testPHOS.root") ;
282 //____________________________________________________________________________
287 const Float_t maxSDigits = 62.89 ;
288 const Float_t widSDigits = TMath::Sqrt(maxSDigits) ;
291 TString reconame = "test suite" ;
293 AliPHOSSDigitizer *sd = new AliPHOSSDigitizer("testPHOS.root",reconame.Data()) ;
294 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
296 sd->ExecuteTask("deb") ;
298 Float_t nSDigits = static_cast<Float_t>(gime->SDigitizer()->GetSDigitsInRun()) / static_cast<Float_t>(gime->MaxEvent()) ;
299 if ( nSDigits < maxSDigits-widSDigits ||
300 nSDigits > maxSDigits+widSDigits ) {
301 mess = "Error detected in the SDigits process. Sending error file to PHOS director." ;
302 cout << "sdigit() : nsDigits = " << nSDigits
303 << " maxSDigits,widSDigits= " << maxSDigits << "," << widSDigits << endl ;
312 //____________________________________________________________________________
317 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
318 TString reconame = "test suite" ;
319 const Float_t maxDigits = 2860. ;
320 const Float_t widDigits = TMath::Sqrt(maxDigits) ;
324 AliPHOSDigitizer *d = new AliPHOSDigitizer("testPHOS.root",reconame.Data()) ;
326 d->ExecuteTask("deb") ;
328 Float_t nDigits = static_cast<Float_t>(gime->Digitizer()->GetDigitsInRun()) / static_cast<Float_t>(gime->MaxEvent()) ;
330 if ( nDigits < maxDigits-widDigits || nDigits > maxDigits+widDigits ) {
331 cout << "digit() : nDigits = " << nDigits
332 << " maxDigits,widDigits= " << maxDigits << "," << widDigits << endl ;
333 mess = "Error detected in the Digits process. Sending error file to PHOS director." ;
342 //____________________________________________________________________________
347 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
348 TString reconame = "test suite" ;
350 const Float_t maxRecPoints = 1.0 ;
351 const Float_t widRecPoints = TMath::Sqrt(maxRecPoints) ;
355 AliPHOSClusterizer * cluster = new AliPHOSClusterizerv1("testPHOS.root", reconame.Data()) ;
357 cluster->ExecuteTask("deb") ;
359 Float_t nRecPoints = static_cast<Float_t>(gime->Clusterizer(reconame.Data())->GetRecPointsInRun()) /
360 static_cast<Float_t>(gime->MaxEvent()) ;
362 if ( nRecPoints < maxRecPoints-widRecPoints
363 || nRecPoints > maxRecPoints+widRecPoints ) {
364 cout << "recpoint() : nRecPoints = " << nRecPoints
365 << " maxRecPoints,widRecPoints= " << maxRecPoints << "," << widRecPoints << endl ;
366 mess = "Error detected in the Clusterizing process. Sending error file to PHOS director." ;
375 //____________________________________________________________________________
379 //TrackSegments process
380 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
381 const Float_t maxTrackSegments = 1 ;
384 TString reconame = "test suite" ;
386 AliPHOSTrackSegmentMaker * tracks = new AliPHOSTrackSegmentMakerv1("testPHOS.root",reconame.Data()) ;
388 tracks->ExecuteTask("deb") ;
390 Float_t nTrackSegments = static_cast<Float_t> (gime->TrackSegmentMaker(reconame.Data())->GetTrackSegmentsInRun()) /
391 static_cast<Float_t>(gime->MaxEvent()) ;
393 if ( nTrackSegments < maxTrackSegments-0.25 ||
394 nTrackSegments > maxTrackSegments+0.25 ) {
395 cout << "track() : nTrackSegments = " << nTrackSegments
396 << " maxTrackSegments,widTrackSegments= " << maxTrackSegments << "," << "0.25" << endl ;
397 mess = "Error detected in the TrackSegments process. Sending error file to PHOS director." ;
406 //____________________________________________________________________________
410 //RecParticles process
411 AliPHOSGetter * gime = AliPHOSGetter::GetInstance("testPHOS.root") ;
412 const Float_t maxRecParticles = 1 ;
415 TString reconame = "test suite" ;
417 AliPHOSPID * pid = new AliPHOSPIDv1("testPHOS.root",reconame.Data()) ;
419 pid->ExecuteTask("deb") ;
421 Float_t nRecParticles = static_cast<Float_t> (gime->PID(reconame.Data())->GetRecParticlesInRun()) /
422 static_cast<Float_t>(gime->MaxEvent()) ;
425 if ( nRecParticles < maxRecParticles-0.25 ||
426 nRecParticles > maxRecParticles+0.25 ) {
427 cout << "particle() : nRecParticles = " << nRecParticles
428 << " maxRecParticles,widRecParticles= " << maxRecParticles << "," << "0.25" << endl ;
429 mess = "Error detected in the RecParticles process. Sending error file to PHOS director.Stop reconstruction." ;
438 //____________________________________________________________________________
439 void write_info(TString mess)
441 cerr << " _____________________________________________________________ " << endl
443 << "MESS ==> " << mess <<endl
444 << " _____________________________________________________________ " <<endl ;