Skip to content

Commit

Permalink
new Preprocessor and DA from Michal
Browse files Browse the repository at this point in the history
  • Loading branch information
alla committed Apr 21, 2008
1 parent f3bc8da commit 7bb49c8
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 156 deletions.
10 changes: 7 additions & 3 deletions T0/AliT0CalibWalk.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/

/* $Id$ */

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -233,6 +232,9 @@ void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
// cout<<i<<" "<<imi<<" "<<" qtc " <<x1[imi]<<" "<<xx[imi]<<
// " led "<<x2[imi]<<" "<<y2[imi]<<" led2d "<<yy1[imi]<<" "<<xx1[imi]<<endl;
}
if(i==0){
cout<<"Making graphs..."<<endl;
}
TGraph *gr1 = new TGraph (10,x1,y1);
TGraph *gr2 = new TGraph (10,x2,y2);
fWalk.AddAtAndExpand(gr1,i);
Expand All @@ -256,7 +258,9 @@ void AliT0CalibWalk::MakeWalkCorrGraph(const char *laserFile)
fQTC.AddAtAndExpand(gr3,i);
fAmpLED.AddAtAndExpand(gr4,i);
// for (Int_t im=0; im<10; im++) { x2[im]=0; y2[im]=0; xx1[im]=0; xx[im]=0;}

if(i==23){
cout<<"Graphs created..."<<endl;
}
}
}

Expand Down
63 changes: 58 additions & 5 deletions T0/AliT0Preprocessor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$Log: AliT0Preprocessor.cxx,v $
Revision 1.8 2007/12/07 15:22:51 alla
bug fixed by Alberto
Revision 1.7 2007/12/06 16:35:24 alla
new bugs fixed by Tomek
Expand Down Expand Up @@ -136,7 +136,7 @@ UInt_t AliT0Preprocessor::ProcessDCSDataPoints(TMap* dcsAliasMap){

UInt_t AliT0Preprocessor::ProcessLaser(){
// Processing data from DAQ Standalone run
Log("Processing Laser calibration");
Log("Processing Laser calibration - Walk Correction");

Bool_t resultLaser=kFALSE;
//processing DAQ
Expand All @@ -159,6 +159,7 @@ UInt_t AliT0Preprocessor::ProcessLaser(){
metaData.SetComment("Walk correction from laser runs.");
resultLaser=Store("Calib","Slewing_Walk", laser, &metaData, 0, 1);
delete laser;
Log(Form("resultLaser = %d",resultLaser));
}
else
{
Expand All @@ -183,7 +184,7 @@ UInt_t AliT0Preprocessor::ProcessPhysics(){
//Processing data from DAQ Physics run
Log("Processing Physics");

Bool_t resultOnline=kFALSE;
Bool_t resultOnline=kFALSE;
//processing DAQ
TList* listPhys = GetFileSources(kDAQ, "PHYSICS");
if (listPhys)
Expand All @@ -203,17 +204,19 @@ UInt_t AliT0Preprocessor::ProcessPhysics(){
metaData.SetResponsible("Tomek&Michal");
metaData.SetComment("Time equalizing result.");
resultOnline = Store("Calib","TimeDelay", online, &metaData, 0, 1);
Log(Form("resultOnline = %d",resultOnline));
delete online;
}
else
else
{
Log(Form("Could not find file with Id PHYSICS in source %s!", sourcePhys->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 {
Expand All @@ -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<TObjString *> (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:
Expand All @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion T0/AliT0Preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */

/* $Id$ */


Expand Down Expand Up @@ -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)
Expand Down
86 changes: 18 additions & 68 deletions T0/T0Cosmicda.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
T0 DA for online calibration
Contact: [email protected]
Link: http://users.jyu.fi/~mioledzk/
Run Type: PHYSICS
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down
Loading

0 comments on commit 7bb49c8

Please sign in to comment.