From 271b5bd33499b977a631a44a7ac8b55bd86a5d48 Mon Sep 17 00:00:00 2001 From: alla Date: Mon, 21 Apr 2008 13:37:27 +0000 Subject: [PATCH] new Preprocessor and DA from Michal --- T0/AliT0CalibWalk.cxx | 10 +++-- T0/AliT0Preprocessor.cxx | 63 ++++++++++++++++++++++++++--- T0/AliT0Preprocessor.h | 3 +- T0/T0Cosmicda.cxx | 86 +++++++++------------------------------- T0/T0Laserda.cxx | 85 +++++++++++++++++++-------------------- T0/T0Physda.cxx | 30 +++++--------- T0/inLaser.dat | 26 ++++++------ 7 files changed, 147 insertions(+), 156 deletions(-) diff --git a/T0/AliT0CalibWalk.cxx b/T0/AliT0CalibWalk.cxx index 2dbacbca6cb..22935bb91cf 100644 --- a/T0/AliT0CalibWalk.cxx +++ b/T0/AliT0CalibWalk.cxx @@ -12,7 +12,7 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ - + /* $Id$ */ /////////////////////////////////////////////////////////////////////////////// @@ -199,7 +199,6 @@ void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile) Double_t *grX ; TFile *gFile = TFile::Open(laserFile); // gFile->ls(); - Float_t x1[10], y1[10]; Float_t x2[10], y2[10]; @@ -233,6 +232,9 @@ void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile) // cout<GetName())); return 1; } + } if (!resultOnline) { - Log("No Laser Data stored"); + Log("No Data stored"); return 4;//return error code for failure in storing OCDB Data } } else { @@ -224,6 +227,53 @@ UInt_t AliT0Preprocessor::ProcessPhysics(){ } //____________________________________________________ +UInt_t AliT0Preprocessor::ProcessCosmic(){ + //Processing data from DAQ Physics run + Log("Processing Laser Physics"); + + Bool_t resultLaserOnline=kFALSE; + //processing DAQ + TList* listLaser = GetFileSources(kDAQ, "COSMIC"); + if (listLaser) + { + TIter iter(listLaser); + TObjString *sourceLaser; + while ((sourceLaser = dynamic_cast (iter.Next()))) + { + const char *fileLaser = GetFile(kDAQ, "COSMIC", sourceLaser->GetName()); + if (fileLaser) + { + AliT0CalibTimeEq *onlineLaser = new AliT0CalibTimeEq(); + onlineLaser->Reset(); + onlineLaser->ComputeOnlineParams(fileLaser); + AliCDBMetaData metaData; + metaData.SetBeamPeriod(0); + metaData.SetResponsible("Tomek&Michal"); + metaData.SetComment("Time equalizing result."); + resultLaserOnline = Store("Calib","LaserTimeDelay", onlineLaser, &metaData, 0, 1); + Log(Form("resultLaserOnline = %d",resultLaserOnline)); + delete onlineLaser; + } + else + { + Log(Form("Could not find file with Id COSMIC in source %s!", sourceLaser->GetName())); + return 0; + } + + } + if (!resultLaserOnline) + { + Log("No Laser Data stored"); + return 0;//return error code for failure in storing OCDB Data + } + } else { + Log("No sources found for id COSMIC!"); + return 0; + } + return 0; +} +//____________________________________________________ + UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap ) { // T0 preprocessor return codes: @@ -246,14 +296,17 @@ UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap ) Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap); return iresultDCS; } + Log(Form("iresultLaser = %d",iresultLaser)); return iresultLaser; } else if(runType == "PHYSICS"){ Int_t iresultPhysics = ProcessPhysics(); + Int_t iresultCosmic = ProcessCosmic(); if(dcsDP==1){ Int_t iresultDCS = ProcessDCSDataPoints(dcsAliasMap); return iresultDCS; } + Log(Form("iresultPhysics = %d",iresultPhysics)); return iresultPhysics; } diff --git a/T0/AliT0Preprocessor.h b/T0/AliT0Preprocessor.h index 79586284f87..2987fa6434f 100644 --- a/T0/AliT0Preprocessor.h +++ b/T0/AliT0Preprocessor.h @@ -3,7 +3,7 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ - + /* $Id$ */ @@ -35,6 +35,7 @@ class AliT0Preprocessor: public AliPreprocessor UInt_t ProcessDCSDataPoints(TMap* dcsAliasMap); UInt_t ProcessLaser(); UInt_t ProcessPhysics(); + UInt_t ProcessCosmic(); AliT0DataDCS *fData; // Data member to process DCS data ClassDef(AliT0Preprocessor, 2) diff --git a/T0/T0Cosmicda.cxx b/T0/T0Cosmicda.cxx index 88b9d60e498..cca2ad63872 100644 --- a/T0/T0Cosmicda.cxx +++ b/T0/T0Cosmicda.cxx @@ -1,6 +1,6 @@ /* T0 DA for online calibration - + Contact: Michal.Oledzki@cern.ch Link: http://users.jyu.fi/~mioledzk/ Run Type: PHYSICS @@ -76,24 +76,9 @@ int main(int argc, char **argv) { while((c=getc(inp))!=EOF) { switch(c) { - case 'a': {fscanf(inp, "%d", &cqbx ); break;} //N of X bins hCFD_QTC - case 'b': {fscanf(inp, "%f", &cqlx ); break;} //Low x hCFD_QTC - case 'c': {fscanf(inp, "%f", &cqmx ); break;} //High x hCFD_QTC - case 'd': {fscanf(inp, "%d", &cqby ); break;} //N of Y bins hCFD_QTC - case 'e': {fscanf(inp, "%f", &cqly ); break;} //Low y hCFD_QTC - case 'f': {fscanf(inp, "%f", &cqmy ); break;} //High y hCFD_QTC - case 'g': {fscanf(inp, "%d", &clbx ); break;} //N of X bins hCFD_LED - case 'h': {fscanf(inp, "%f", &cllx ); break;} //Low x hCFD_LED - case 'i': {fscanf(inp, "%f", &clmx ); break;} //High x hCFD_LED - case 'j': {fscanf(inp, "%d", &clby ); break;} //N of Y bins hCFD_LED - case 'k': {fscanf(inp, "%f", &clly ); break;} //Low y hCFD_LED - case 'l': {fscanf(inp, "%f", &clmy ); break;} //High y hCFD_LED - case 'm': {fscanf(inp, "%d", &cbx ); break;} //N of Y bins hCFD - case 'n': {fscanf(inp, "%f", &clx ); break;} //Low x hCFD - case 'o': {fscanf(inp, "%f", &cmx ); break;} //High x hCFD - case 'p': {fscanf(inp, "%d", &ccbx ); break;} //N of X bins hCFD1_CFD - case 'r': {fscanf(inp, "%f", &cclx ); break;} //Low x hCFD1_CFD - case 's': {fscanf(inp, "%f", &ccmx ); break;} //High x hCFD1_CFD + 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_CFD } } fclose(inp); @@ -129,21 +114,10 @@ int main(int argc, char **argv) { printf("T0 monitoring program started\n"); // Allocation of histograms - start - TH1F *hCFD[24]; TH1F *hCFD1minCFD[24]; - TH2F *hCFDvsQTC[24]; - TH2F *hCFDvsLED[24]; for(Int_t ic=0; ic<24; ic++) { - hCFDvsQTC[ic] = new TH2F(Form("CFD_QTC%d",ic+1),"CFD_QTC",cqbx,cqlx,cqmx,cqby,cqly,cqmy); - hCFDvsLED[ic] = new TH2F(Form("CFD_LED%d",ic+1),"CFD_LED",clbx,cllx,clmx,clby,clly,clmy); hCFD1minCFD[ic] = new TH1F(Form("CFD1-CFD%d",ic+1),"CFD-CFD",ccbx,cclx,ccmx); - if(ic<12){ - hCFD[ic] = new TH1F(Form("T0_C_%d_CFD",ic+1),"CFD", cbx,clx,cmx); - } - else{ - hCFD[ic] = new TH1F(Form("T0_A_%d_CFD",ic-11),"CFD", cbx,clx,cmx); - } } // Allocation of histograms - end @@ -207,50 +181,29 @@ int main(int argc, char **argv) { for(Int_t i0=0;i0<105;i0++) for(Int_t j0=0;j0<5;j0++) allData[i0][j0] = 0; - - if(start->Next()) - for (Int_t i=0; i<105; i++) { + + if(start->Next()){ + for (Int_t i=0; i<105; i++) { for(Int_t iHit=0;iHit<5;iHit++){ allData[i][iHit]= start->GetData(i,iHit); } + } } - else - printf("No T0 data found!!\n"); + else + printf("No T0 data found!!!\n"); // Fill the histograms - for (Int_t ik = 0; ik<24; ik+=2) - for (Int_t iHt=0; iHt<5; iHt++){ - Int_t cc = ik/2; - if((allData[cc+1][iHt]-allData[0][0]+5000)!=0 && allData[cc+1][iHt]>0){ - hCFD[cc]->Fill(allData[cc+1][iHt]-allData[0][0]+5000); - } - if((allData[cc+1][iHt]!=0) && (allData[1][iHt]!=0)){ - hCFD1minCFD[cc]->Fill(allData[cc+1][iHt]-allData[1][iHt]); - } - if(allData[ik+25][iHt]!=0 && allData[ik+26][iHt]!=0 && allData[cc+1][iHt]!=0){ - hCFDvsQTC[cc]->Fill((allData[ik+25][iHt]-allData[ik+26][iHt]) , (allData[cc+1][iHt]-allData[0][0]+5000)); - } - if(allData[cc+13][iHt]!=0 && allData[cc+1][iHt]!=0){ - hCFDvsLED[cc]->Fill(allData[cc+13][iHt]-allData[cc+1][iHt],allData[cc+1][iHt]-allData[0][0]+5000); - } - } - - for (Int_t ik = 24; ik<48; ik+=2) + for (Int_t ik = 0; ik<24; ik++) for (Int_t iHt=0; iHt<5; iHt++){ - Int_t cc = ik/2; - if((allData[cc+45][iHt]-allData[0][0]+5000)!=0 && allData[cc+45][iHt]>0){ - hCFD[cc]->Fill(allData[cc+45][iHt]-allData[0][0]+5000); - } - if((allData[cc+45][iHt]!=0) && (allData[57][iHt]!=0)){ - hCFD1minCFD[cc]->Fill(allData[cc+45][iHt]-allData[57][iHt]); - } - if(allData[ik+57][iHt]!=0 && allData[ik+58][iHt]!=0 && allData[cc+45][iHt]!=0){ - hCFDvsQTC[cc]->Fill(allData[ik+57][iHt]-allData[ik+58][iHt],allData[cc+45][iHt]-allData[0][0]+5000); + if(allData[ik+1][iHt]!=0 ){ + if(ik<12){ + hCFD1minCFD[ik]->Fill(allData[ik+1][iHt]-allData[1][iHt]); + } + if(ik>11){ + hCFD1minCFD[ik]->Fill(allData[ik+45][iHt]-allData[57][iHt]); + } } - if(allData[cc+57][iHt]!=0 && allData[cc+45][iHt]!=0){ - hCFDvsLED[cc]->Fill(allData[cc+57][iHt]-allData[cc+45][iHt],allData[cc+45][iHt]-allData[0][0]+5000); - } } delete start; @@ -275,9 +228,6 @@ int main(int argc, char **argv) { TFile *hist = new TFile(FILE_OUT,"RECREATE"); for(Int_t j=0;j<24;j++){ - hCFDvsQTC[j]->Write(); - hCFDvsLED[j]->Write(); - hCFD[j]->Write(); hCFD1minCFD[j]->Write(); } hist->Close(); diff --git a/T0/T0Laserda.cxx b/T0/T0Laserda.cxx index 5088aaf7eb0..4616eb49c3c 100644 --- a/T0/T0Laserda.cxx +++ b/T0/T0Laserda.cxx @@ -1,6 +1,6 @@ /* T0 DA for online calibration - + Contact: Michal.Oledzki@cern.ch Link: http://users.jyu.fi/~mioledzk/ Run Type: STANDALONE @@ -44,8 +44,8 @@ Trigger types used: CALIBRATION_EVENT #include "TSpectrum.h" #include "TVirtualFitter.h" //#include "TProfile.h" -int cqbx,cqby,clbx,clby,cbx; -float cqlx,cqmx,cqly,cqmy,cllx,clmx,clly,clmy,clx,cmx; +int cqbx,cqby,clbx,clby,mod; +float cqlx,cqmx,cqly,cqmy,cllx,clmx,clly,clmy; /* Main routine Arguments: 1- monitoring data source @@ -88,9 +88,7 @@ int main(int argc, char **argv) { case 'j': {fscanf(inp, "%d", &clby ); break;} //N of Y bins hCFD_LED case 'k': {fscanf(inp, "%f", &clly ); break;} //Low y hCFD_LED case 'l': {fscanf(inp, "%f", &clmy ); break;} //High y hCFD_LED - case 'm': {fscanf(inp, "%d", &cbx ); break;} //N of Y bins hCFD - case 'n': {fscanf(inp, "%f", &clx ); break;} //Low x hCFD - case 'o': {fscanf(inp, "%f", &cmx ); break;} //High x hCFD + case 'm': {fscanf(inp, "%d", &mod ); break;} //Modulo number } } fclose(inp); @@ -126,24 +124,20 @@ int main(int argc, char **argv) { printf("T0 monitoring program started\n"); // Allocation of histograms - start - TH1F *hCFD[24]; - TH2F *hCFDvsQTC[24]; - TH2F *hCFDvsLED[24]; - - for(Int_t ic=0; ic<24; ic++) { - hCFDvsQTC[ic] = new TH2F(Form("CFD_QTC%d",ic+1),"CFD_QTC",cqbx,cqlx,cqmx,cqby,cqly,cqmy); - hCFDvsLED[ic] = new TH2F(Form("CFD_LED%d",ic+1),"CFD_LED",clbx,cllx,clmx,clby,clly,clmy); - if(ic<12){ - hCFD[ic] = new TH1F(Form("T0_C_%d_CFD",ic+1),"CFD", cbx,clx,cmx); - } - else{ - hCFD[ic] = new TH1F(Form("T0_A_%d_CFD",ic-11),"CFD", cbx,clx,cmx); - } + TH2F *hCFDvsQTC[24][10]; + TH2F *hCFDvsLED[24][10]; + + for(Int_t ic=0; ic<24; ic++) + for(Int_t im=0;im<10;im++) + { + hCFDvsQTC[ic][im] = new TH2F(Form("CFDvsQTC%d_%d",ic+1,im+1),"CFDvsQTC",cqbx,cqlx,cqmx,cqby,cqly,cqmy); + hCFDvsLED[ic][im] = new TH2F(Form("CFDvsLED%d_%d",ic+1,im+1),"CFDvsLED",clbx,cllx,clmx,clby,clly,clmy); } // Allocation of histograms - end Int_t iev=0; + Int_t mip=0; /* main loop (infinite) */ for(;;) { struct eventHeaderStruct *event; @@ -169,8 +163,6 @@ int main(int argc, char **argv) { continue; } -// iev++; - /* use event - here, just write event id to result file */ eventT=event->eventType; @@ -198,50 +190,54 @@ int main(int argc, char **argv) { 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[106][5]; + for(Int_t i0=0;i0<106;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 iHit=0;iHit<5;iHit++){ + if(start->Next()){ + for (Int_t i=0; i<106; i++) { + for(Int_t iHit=0;iHit<5;iHit++){ allData[i][iHit]= start->GetData(i,iHit); + } } - } + } else - printf("No T0 data found!!\n"); + printf("No data for T0 found!!!\n"); // Fill the histograms - + + if(iev<10000){ + mip=0; + }else + if((iev%mod)==0.0){ + mip++; +// printf("mip = %d\n",mip); + if(mip>=9) mip=9;} + + for (Int_t ik = 0; ik<24; ik+=2) for (Int_t iHt=0; iHt<5; iHt++){ Int_t cc = ik/2; - if((allData[cc+1][iHt]-allData[0][0]+5000)!=0 && allData[cc+1][iHt]>0){ - hCFD[cc]->Fill(allData[cc+1][iHt]-allData[0][0]+5000); - } if(allData[ik+25][iHt]!=0 && allData[ik+26][iHt]!=0 && allData[cc+1][iHt]!=0){ - hCFDvsQTC[cc]->Fill((allData[ik+25][iHt]-allData[ik+26][iHt]) , (allData[cc+1][iHt]-allData[0][0]+5000)); + hCFDvsQTC[cc][mip]->Fill((allData[ik+25][iHt]-allData[ik+26][iHt]) , (allData[cc+1][iHt]-allData[0][0]+5000)); } if(allData[cc+13][iHt]!=0 && allData[cc+1][iHt]!=0){ - hCFDvsLED[cc]->Fill(allData[cc+13][iHt]-allData[cc+1][iHt],allData[cc+1][iHt]-allData[0][0]+5000); + hCFDvsLED[cc][mip]->Fill(allData[cc+13][iHt]-allData[cc+1][iHt],allData[cc+1][iHt]-allData[0][0]+5000); } } for (Int_t ik = 24; ik<48; ik+=2) for (Int_t iHt=0; iHt<5; iHt++){ Int_t cc = ik/2; - if((allData[cc+45][iHt]-allData[0][0]+5000)!=0 && allData[cc+45][iHt]>0){ - hCFD[cc]->Fill(allData[cc+45][iHt]-allData[0][0]+5000); - } if(allData[ik+57][iHt]!=0 && allData[ik+58][iHt]!=0 && allData[cc+45][iHt]!=0){ - hCFDvsQTC[cc]->Fill(allData[ik+57][iHt]-allData[ik+58][iHt],allData[cc+45][iHt]-allData[0][0]+5000); + hCFDvsQTC[cc][mip]->Fill(allData[ik+57][iHt]-allData[ik+58][iHt],allData[cc+45][iHt]-allData[0][0]+5000); } if(allData[cc+57][iHt]!=0 && allData[cc+45][iHt]!=0){ - hCFDvsLED[cc]->Fill(allData[cc+57][iHt]-allData[cc+45][iHt],allData[cc+45][iHt]-allData[0][0]+5000); + hCFDvsLED[cc][mip]->Fill(allData[cc+57][iHt]-allData[cc+45][iHt],allData[cc+45][iHt]-allData[0][0]+5000); } } - + delete start; start = 0x0; reader->Reset(); @@ -263,10 +259,11 @@ int main(int argc, char **argv) { // write a file with the histograms TFile *hist = new TFile(FILE_OUT,"RECREATE"); - for(Int_t j=0;j<24;j++){ - hCFDvsQTC[j]->Write(); - hCFDvsLED[j]->Write(); - hCFD[j]->Write(); + for(Int_t j=0;j<24;j++) + for(Int_t k=0;k<10;k++) + { + hCFDvsQTC[j][k]->Write(); + hCFDvsLED[j][k]->Write(); } hist->Close(); delete hist; diff --git a/T0/T0Physda.cxx b/T0/T0Physda.cxx index 2b60066b71a..f2ebf94ca0d 100644 --- a/T0/T0Physda.cxx +++ b/T0/T0Physda.cxx @@ -1,6 +1,6 @@ /* T0 DA for online calibration - + Contact: Michal.Oledzki@cern.ch Link: http://users.jyu.fi/~mioledzk/ Run Type: PHYSICS @@ -79,9 +79,9 @@ int main(int argc, char **argv) { 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_CFD - case 'd': {fscanf(inp, "%d", &cbx ); break;} //N of X bins hCFD - case 'e': {fscanf(inp, "%f", &clx ); break;} //Low x hCFD - case 'f': {fscanf(inp, "%f", &cmx ); break;} //High x hCFD +// case 'd': {fscanf(inp, "%d", &cbx ); break;} //N of X bins hCFD +// case 'e': {fscanf(inp, "%f", &clx ); break;} //Low x hCFD +// case 'f': {fscanf(inp, "%f", &cmx ); break;} //High x hCFD } } fclose(inp); @@ -119,17 +119,9 @@ int main(int argc, char **argv) { // Allocation of histograms - start TH1F *hCFD1minCFD[24]; - TH1F *hCFD[24]; for(Int_t ic=0; ic<24; ic++) { - if(ic<12) { hCFD1minCFD[ic] = new TH1F(Form("CFD1-CFD%d",ic+1),"CFD-CFD",ccbx,cclx,ccmx); - hCFD[ic] = new TH1F(Form("CFD%i",ic+1),"CFD",cbx,clx,cmx); - } - if(ic>11){ - hCFD1minCFD[ic] = new TH1F(Form("CFD1-CFD%i",ic+1),"CFD-CFD",ccbx,cclx,ccmx); - hCFD[ic] = new TH1F(Form("CFD%i",ic+1),"CFD",cbx,clx,cmx); - } } // Allocation of histograms - end @@ -159,8 +151,6 @@ int main(int argc, char **argv) { if (event==NULL) { continue; } - -// iev++; /* use event - here, just write event id to result file */ eventT=event->eventType; @@ -193,15 +183,16 @@ int main(int argc, char **argv) { for(Int_t i0=0;i0<105;i0++) for(Int_t j0=0;j0<5;j0++) allData[i0][j0] = 0; - - if(start->Next()) - for (Int_t i=0; i<105; i++) { + + if(start->Next()){ + for (Int_t i=0; i<105; i++) { for(Int_t iHit=0;iHit<5;iHit++){ allData[i][iHit]= start->GetData(i,iHit); } + } } else - printf("No T0 data found!!\n"); + printf("No T0 data found!!!\n"); // Fill the histograms @@ -210,11 +201,9 @@ int main(int argc, char **argv) { if(allData[ik+1][iHt]!=0 ){ if(ik<12){ hCFD1minCFD[ik]->Fill(allData[ik+1][iHt]-allData[1][iHt]); - hCFD[ik]->Fill(allData[ik+13][iHt]); } if(ik>11){ hCFD1minCFD[ik]->Fill(allData[ik+45][iHt]-allData[57][iHt]); - hCFD[ik]->Fill(allData[ik+45][iHt]); } } } @@ -242,7 +231,6 @@ int main(int argc, char **argv) { for(Int_t j=0;j<24;j++){ hCFD1minCFD[j]->Write(); - hCFD[j]->Write(); } hist->Close(); delete hist; diff --git a/T0/inLaser.dat b/T0/inLaser.dat index 0b8f143ac88..174acad46ca 100644 --- a/T0/inLaser.dat +++ b/T0/inLaser.dat @@ -1,15 +1,13 @@ -a 100 -b 0.5 -c 8000.5 -d 100 -e 10000.5 -f 20000.5 +a 500 +b 0.0 +c 5000.0 +d 1000 +e 1000.0 +f 3000.0 g 100 -h -500.0 -i 500.0 -j 100 -k 14600.0 -l 14700.0 -m 1000 -n 14000.0 -o 30000.0 +h 0.0 +i 1000.0 +j 300 +k 1000.0 +l 3000.0 +m 10000 -- 2.39.3