#include "TPluginManager.h"
#include "TFile.h"
#include "TKey.h"
-#include "TH2S.h"
#include "TObject.h"
#include "TBenchmark.h"
-#include "TRandom.h"
-#include "TCanvas.h"
#include "TString.h"
#include "TH1.h"
-#include "TF1.h"
#include "TSpectrum.h"
-#include "TVirtualFitter.h"
-int cbx, ccbx, npmtA, npmtC;
-float clx,cmx,cclx,ccmx;
+#include "TMath.h"
+
/* Main routine
Arguments:
printf("Input file >>inPhys.dat<< not found !!!\n");
return -1;
}
+ int kcbx, kt0bx, knpmtA, knpmtC;
+ float kclx,kcmx, kt0lx, kt0hx;
while((c=getc(inp))!=EOF) {
switch(c) {
- case 'a': {fscanf(inp, "%d", &ccbx ); break;} //N of X bins hCFD1_CFD
- case 'b': {fscanf(inp, "%f", &cclx ); break;} //Low x hCFD1_CFD
- case 'c': {fscanf(inp, "%f", &ccmx ); break;} //High x hCFD1_CF
- case 'd': {fscanf(inp, "%d", &npmtC ); break;} //number of reference PMTC
- case 'e': {fscanf(inp, "%d", &npmtA ); break;} //number of reference PMTA
+ case 'a': {fscanf(inp, "%d", &kcbx ); break;} //N of X bins hCFD1_CFD
+ case 'b': {fscanf(inp, "%f", &kclx ); break;} //Low x hCFD1_CFD
+ case 'c': {fscanf(inp, "%f", &kcmx ); break;} //High x hCFD1_CF
+ case 'd': {fscanf(inp, "%d", &knpmtC ); break;} //number of reference PMTC
+ case 'e': {fscanf(inp, "%d", &knpmtA ); break;} //number of reference PMTA
+ case 'f': {fscanf(inp, "%d", &kt0bx ); break;} //N of X bins hT0
+ case 'g': {fscanf(inp, "%f", &kt0lx ); break;} //Low x hT0
+ case 'k': {fscanf(inp, "%f", &kt0hx ); break;} //High x hT0
}
}
fclose(inp);
// Allocation of histograms - start
TH1F *hCFD1minCFD[24];
+ TH1F *hCFD[24];
for(Int_t ic=0; ic<24; ic++) {
- hCFD1minCFD[ic] = new TH1F(Form("CFD1minCFD%d",ic+1),"CFD-CFD",ccbx,cclx,ccmx);
+ hCFD1minCFD[ic] = new TH1F(Form("CFD1minCFD%d",ic+1),"CFD-CFD",kcbx,kclx,kcmx);
+ hCFD[ic] = new TH1F(Form("CFD%d",ic+1),"CFD",kt0bx,kt0lx,kt0hx);
}
- TH1F *hVertex = new TH1F("hVertex","Z vertex",ccbx,cclx,ccmx);
+ TH1F *hVertex = new TH1F("hVertex","T0 time",kt0bx,kt0lx,kt0hx);
-
- // Allocation of histograms - end
+ // Allocation of histograms - end
Int_t iev=0;
/* main loop (infinite) */
switch (event->eventType){
- case START_OF_RUN:
- break;
+ case START_OF_RUN:
+ break;
case END_OF_RUN:
break;
- // case PHYSICS_EVENT:
- case CALIBRATION_EVENT:
+ case PHYSICS_EVENT:
+ // case CALIBRATION_EVENT:
iev++;
if(iev==1){
AliT0RawReader *start = new AliT0RawReader(reader, kTRUE);
// Read raw data
- Int_t allData[105][5];
- for(Int_t i0=0;i0<105;i0++)
+ Int_t allData[110][5];
+ for(Int_t i0=0;i0<107;i0++)
for(Int_t j0=0;j0<5;j0++)
allData[i0][j0] = 0;
if(start->Next()){
- for (Int_t i=0; i<105; i++) {
+ for (Int_t i=0; i<107; i++) {
for(Int_t iHit=0;iHit<5;iHit++){
allData[i][iHit]= start->GetData(i,iHit);
}
Float_t besttimeA=9999999;
Float_t besttimeC=9999999;
Float_t time[24];
- Int_t acshift=56;
- for (Int_t ik = 0; ik<24; ik++)
- if(allData[ik+1][0]>0 ){
- if(ik<12
- && (allData[ik+13][0]-allData[ik+1][0]) < 530 ){
- hCFD1minCFD[ik]->Fill(allData[ik+1][0]-allData[npmtC][0]);
- }
- if(ik>11
- && (allData[ik+57][0]-allData[ik+45][0]) <530 ){
- hCFD1minCFD[ik]->Fill(allData[ik+45][0]-allData[56+npmtA][0]);
+ Float_t meanShift[24];
+ for (Int_t ik = 0; ik<24; ik++)
+ {
+ if(ik<12 && allData[ik+1][0]>0 && allData[knpmtC][0]>0 ){
+ hCFD1minCFD[ik]->Fill(allData[ik+1][0]-allData[knpmtC][0]);
+ if(allData[ik+1][0]>0 ) hCFD[ik]->Fill(allData[ik+1][0]);
+ }
+
+ if(ik>11 && allData[ik+45][0]>0 && allData[56+knpmtA][0]>0 )
+ {
+ hCFD1minCFD[ik]->Fill(allData[ik+45][0]-allData[56+knpmtA][0]);
+ if(allData[ik+1][0]>0 ) hCFD[ik]->Fill(allData[ik+45][0]);
+ }
+ if(iev == 10000) {
+ meanShift[ik] = hCFD1minCFD[ik]->GetMean();
+ if(ik==knpmtC || ik==(56+knpmtA)) meanShift[ik]=0;
+ }
+ }
+ //fill mean time _ fast reconstruction
+ if (iev > 10000 )
+ {
+ for (Int_t in=0; in<12; in++)
+ {
+ time[in] = allData[in+1][0] - meanShift[in] ;
+ time[in+12] = allData[in+56+1][0] ;
+ }
+ for (Int_t ipmt=0; ipmt<12; ipmt++){
+ if(time[ipmt] > 1 ) {
+ if(time[ipmt]<besttimeC)
+ besttimeC=time[ipmt]; //timeC
+ }
}
-
+ for ( Int_t ipmt=12; ipmt<24; ipmt++){
+ if(time[ipmt] > 1) {
+ if(time[ipmt]<besttimeA)
+ besttimeA=time[ipmt]; //timeA
+ }
+ }
+ if(besttimeA<9999999 &&besttimeC< 9999999) {
+ Float_t t0 =0.001* 24.4 * Float_t( besttimeA+besttimeC)/2.;
+ hVertex->Fill(t0);
+ }
}
- delete start;
- start = 0x0;
- reader->Reset();
+
+ delete start;
+ start = 0x0;
+ delete reader;
+ reader= 0x0;
// End of fill histograms
}
printf("After loop, before writing histos\n");
// write a file with the histograms
- TFile *hist = new TFile(FILE_OUT,"RECREATE");
+ TFile hist(FILE_OUT,"RECREATE");
for(Int_t j=0;j<24;j++){
- hCFD1minCFD[j]->Write();
- }
+ hCFD1minCFD[j]->SetDirectory(&hist);
+ hCFD1minCFD[j]->Write();
+ hCFD[j]->Write();
+
+ }
hVertex->Write();
- hist->Close();
- delete hist;
+ hist.Close();
+ //delete hist;
status=0;