]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDTagCreator.cxx
Update of the tag system. 1. Correct implementation of the event ID - period, orbit...
[u/mrichter/AliRoot.git] / STEER / AliESDTagCreator.cxx
index 030655f140ac3d83b5f665d10f6ee985a7cb2034..7534263bd1f30f9be83fa8923b3304d50c167fc5 100644 (file)
@@ -43,6 +43,7 @@
 #include "AliESDEvent.h"
 #include "AliESDVertex.h"
 #include "AliLog.h"
+#include "AliGRPObject.h"
 
 #include "AliESDTagCreator.h"
 
@@ -220,7 +221,7 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
   // Creates the tags for all the events in a given ESD file
   Bool_t fIsSim = kTRUE;
   Int_t ntrack;
-  Int_t nProtons, nKaons, nPions, nMuons, nElectrons;
+  Int_t nProtons, nKaons, nPions, nMuons, nElectrons, nFWMuons;
   Int_t nPos, nNeg, nNeutr;
   Int_t nK0s, nNeutrons, nPi0s, nGamas;
   Int_t nCh1GeV, nCh3GeV, nCh10GeV;
@@ -285,7 +286,7 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
     ntrack = 0; nPos = 0; nNeg = 0; nNeutr =0;
     nK0s = 0; nNeutrons = 0; nPi0s = 0;
     nGamas = 0; nProtons = 0; nKaons = 0;
-    nPions = 0; nMuons = 0; nElectrons = 0;      
+    nPions = 0; nMuons = 0; nElectrons = 0; nFWMuons = 0;        
     nCh1GeV = 0; nCh3GeV = 0; nCh10GeV = 0;
     nMu1GeV = 0; nMu3GeV = 0; nMu10GeV = 0;
     nEl1GeV = 0; nEl3GeV = 0; nEl10GeV = 0;
@@ -328,8 +329,9 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
@@ -406,6 +408,7 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
       // total number of muons inside a vertex cut 
       if((TMath::Abs(fZ)<fZVertexCut) && (TMath::Sqrt(fY*fY+fX*fX)<fRhoVertexCut)) {
        nMuons++;
+       nFWMuons++;
        if(fEPvector.Pt() > fLowPtCut) {
          nMu1GeV++; 
          if(fEPvector.Pt() > fHighPtCut) {
@@ -425,7 +428,16 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
     //AliInfo(Form("URL: %s - GUID: %s",fturl.Data(),fguid.Data()));
     //AliInfo(Form("====================================="));
 
-    evTag->SetEventId(iEventNumber+1);
+    //First physics data
+    const AliMultiplicity *spdMult = esd->GetMultiplicity();
+    evTag->SetNumberOfFiredChipsLayer1(spdMult->GetNumberOfFiredChips(0));
+    evTag->SetNumberOfFiredChipsLayer2(spdMult->GetNumberOfFiredChips(1));
+    evTag->SetNumberOfSPDTracklets(spdMult->GetNumberOfTracklets());
+
+    //evTag->SetEventId(iEventNumber+1);
+    evTag->SetPeriodNumber(esd->GetPeriodNumber());
+    evTag->SetOrbitNumber(esd->GetOrbitNumber());
+    evTag->SetBunchCrossNumber(esd->GetBunchCrossNumber());
     evTag->SetGUID(fguid);
     if(fSession == "grid") {
       evTag->SetMD5(0);
@@ -451,6 +463,8 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
     evTag->SetZDCNeutron1Energy(esd->GetZDCN2Energy());
     evTag->SetZDCProton1Energy(esd->GetZDCP2Energy());
     evTag->SetNumOfParticipants(esd->GetZDCParticipants());
+    evTag->SetNumOfParticipants(esd->GetZDCParticipants());
+    evTag->SetNumOfParticipants2(esd->GetZDCParticipants2());
     
     
     evTag->SetNumOfTracks(esd->GetNumberOfTracks());
@@ -467,6 +481,7 @@ void AliESDTagCreator::CreateTag(TChain* chain, const char *type) {
     evTag->SetNumOfKaons(nKaons);
     evTag->SetNumOfPions(nPions);
     evTag->SetNumOfMuons(nMuons);
+    evTag->SetNumOfFWMuons(nFWMuons);
     evTag->SetNumOfElectrons(nElectrons);
     evTag->SetNumOfPhotons(nGamas);
     evTag->SetNumOfPi0s(nPi0s);
@@ -564,7 +579,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
   // Creates the tags for all the events in a given ESD file
   Bool_t fIsSim = kTRUE;
   Int_t ntrack;
-  Int_t nProtons, nKaons, nPions, nMuons, nElectrons;
+  Int_t nProtons, nKaons, nPions, nMuons, nElectrons, nFWMuons;
   Int_t nPos, nNeg, nNeutr;
   Int_t nK0s, nNeutrons, nPi0s, nGamas;
   Int_t nCh1GeV, nCh3GeV, nCh10GeV;
@@ -612,6 +627,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
     nKaons = 0;
     nPions = 0;
     nMuons = 0;
+    nFWMuons = 0;
     nElectrons = 0;      
     nCh1GeV = 0;
     nCh3GeV = 0;
@@ -649,8 +665,9 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
@@ -727,6 +744,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
       // total number of muons inside a vertex cut 
       if((TMath::Abs(fZ)<fZVertexCut) && (TMath::Sqrt(fY*fY+fX*fX)<fRhoVertexCut)) {
        nMuons++;
+       nFWMuons++;
        if(fEPvector.Pt() > fLowPtCut) {
          nMu1GeV++; 
          if(fEPvector.Pt() > fHighPtCut) {
@@ -742,7 +760,17 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
     // Fill the event tags 
     if(ntrack != 0) meanPt = meanPt/ntrack;
     
-    evTag->SetEventId(iEventNumber+1);
+    //First physics data
+    const AliMultiplicity *spdMult = esd->GetMultiplicity();
+    evTag->SetNumberOfFiredChipsLayer1(spdMult->GetNumberOfFiredChips(0));
+    evTag->SetNumberOfFiredChipsLayer2(spdMult->GetNumberOfFiredChips(1));
+    evTag->SetNumberOfSPDTracklets(spdMult->GetNumberOfTracklets());
+
+    //evTag->SetEventId(iEventNumber+1);
+    evTag->SetPeriodNumber(esd->GetPeriodNumber());
+    evTag->SetOrbitNumber(esd->GetOrbitNumber());
+    evTag->SetBunchCrossNumber(esd->GetBunchCrossNumber());
+
     evTag->SetGUID(fguid);
     evTag->SetMD5(fmd5);
     evTag->SetTURL(fturl);
@@ -780,6 +808,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *guid, const char *md5,
     evTag->SetNumOfKaons(nKaons);
     evTag->SetNumOfPions(nPions);
     evTag->SetNumOfMuons(nMuons);
+    evTag->SetNumOfFWMuons(nFWMuons);
     evTag->SetNumOfElectrons(nElectrons);
     evTag->SetNumOfPhotons(nGamas);
     evTag->SetNumOfPi0s(nPi0s);
@@ -887,7 +916,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
   // Creates the tags for all the events in a given ESD file
   Bool_t fIsSim = kTRUE;
   Int_t ntrack;
-  Int_t nProtons, nKaons, nPions, nMuons, nElectrons;
+  Int_t nProtons, nKaons, nPions, nMuons, nElectrons, nFWMuons;
   Int_t nPos, nNeg, nNeutr;
   Int_t nK0s, nNeutrons, nPi0s, nGamas;
   Int_t nCh1GeV, nCh3GeV, nCh10GeV;
@@ -929,6 +958,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
     nKaons = 0;
     nPions = 0;
     nMuons = 0;
+    nFWMuons = 0;
     nElectrons = 0;      
     nCh1GeV = 0;
     nCh3GeV = 0;
@@ -966,8 +996,9 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
@@ -1044,6 +1075,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
       // total number of muons inside a vertex cut 
       if((TMath::Abs(fZ)<fZVertexCut) && (TMath::Sqrt(fY*fY+fX*fX)<fRhoVertexCut)) {
        nMuons++;
+       nFWMuons++;
        if(fEPvector.Pt() > fLowPtCut) {
          nMu1GeV++; 
          if(fEPvector.Pt() > fHighPtCut) {
@@ -1059,7 +1091,16 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
     // Fill the event tags 
     if(ntrack != 0) meanPt = meanPt/ntrack;
     
-    evTag->SetEventId(iEventNumber+1);
+    //First physics data
+    const AliMultiplicity *spdMult = esd->GetMultiplicity();
+    evTag->SetNumberOfFiredChipsLayer1(spdMult->GetNumberOfFiredChips(0));
+    evTag->SetNumberOfFiredChipsLayer2(spdMult->GetNumberOfFiredChips(1));
+    evTag->SetNumberOfSPDTracklets(spdMult->GetNumberOfTracklets());
+
+    //evTag->SetEventId(iEventNumber+1);
+    evTag->SetPeriodNumber(esd->GetPeriodNumber());
+    evTag->SetOrbitNumber(esd->GetOrbitNumber());
+    evTag->SetBunchCrossNumber(esd->GetBunchCrossNumber());
     evTag->SetPath(filepath);
  
     evTag->SetVertexX(vertexIn->GetXv());
@@ -1095,6 +1136,7 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
     evTag->SetNumOfKaons(nKaons);
     evTag->SetNumOfPions(nPions);
     evTag->SetNumOfMuons(nMuons);
+    evTag->SetNumOfFWMuons(nFWMuons);
     evTag->SetNumOfElectrons(nElectrons);
     evTag->SetNumOfPhotons(nGamas);
     evTag->SetNumOfPi0s(nPi0s);
@@ -1163,29 +1205,20 @@ void AliESDTagCreator::CreateTag(TFile* file, const char *filepath, Int_t Counte
 }
 
 //_____________________________________________________________________________
-void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *grpData) {
+void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, AliGRPObject *grpData, ULong_t * qa, Bool_t * es, Int_t qalength, Int_t eslength) {
   //GRP
   Float_t lhcLuminosity = 0.0;
   TString lhcState = "test";
-  UInt_t detectorMask = 0;
+  //UInt_t detectorMask = 0;
+  Int_t detectorMask = 0;
 
-  TObjString *s = new TObjString;
-  s = (TObjString *)grpData->GetValue("fDetectorMask");
-  detectorMask = atoi(s->GetString().Data());
-  
-  s = (TObjString *)grpData->GetValue("fAliceStartTime");
-  Float_t startTime = atof(s->GetString().Data());
+  detectorMask = grpData->GetDetectorMask();
+  time_t startTime = grpData->GetTimeStart();
   TTimeStamp *t1 = new TTimeStamp(startTime);
-
-  s = (TObjString *)grpData->GetValue("fAliceStopTime");
-  Float_t stopTime = atof(s->GetString().Data());
-  TTimeStamp *t2 = new TTimeStamp(stopTime);
-
-  s = (TObjString *)grpData->GetValue("fAliceBeamType");
-  const char* beamtype = s->GetString().Data();
-
-  s = (TObjString *)grpData->GetValue("fAliceBeamEnergy");
-  Float_t beamenergy = atof(s->GetString().Data());
+  time_t endTime = grpData->GetTimeEnd();
+  TTimeStamp *t2 = new TTimeStamp(endTime);
+  const char* beamtype = grpData->GetBeamType();
+  Float_t beamenergy = grpData->GetBeamEnergy();
 
 
   /////////////
@@ -1211,7 +1244,7 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *
 
   // Creates the tags for all the events in a given ESD file
   Int_t ntrack;
-  Int_t nProtons, nKaons, nPions, nMuons, nElectrons;
+  Int_t nProtons, nKaons, nPions, nMuons, nElectrons, nFWMuons;
   Int_t nPos, nNeg, nNeutr;
   Int_t nK0s, nNeutrons, nPi0s, nGamas;
   Int_t nCh1GeV, nCh3GeV, nCh10GeV;
@@ -1270,6 +1303,7 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *
     nKaons = 0;
     nPions = 0;
     nMuons = 0;
+    nFWMuons = 0;
     nElectrons = 0;      
     nCh1GeV = 0;
     nCh3GeV = 0;
@@ -1305,8 +1339,9 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *
       if ((status&AliESDtrack::kESDpid)==0) continue;
       Double_t p[3];
       esdTrack->GetPxPyPz(p);
-      Double_t momentum = sqrt(pow(p[0],2) + pow(p[1],2) + pow(p[2],2));
-      Double_t fPt = sqrt(pow(p[0],2) + pow(p[1],2));
+      Double_t pt2 = p[0]*p[0]+p[1]*p[1];
+      Double_t momentum = TMath::Sqrt(pt2+p[2]*p[2]);
+      Double_t fPt = TMath::Sqrt(pt2);
       totalP += momentum;
       meanPt += fPt;
       if(fPt > maxPt) maxPt = fPt;
@@ -1383,6 +1418,7 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *
       // total number of muons inside a vertex cut 
       if((TMath::Abs(fZ)<fZVertexCut) && (TMath::Sqrt(fY*fY+fX*fX)<fRhoVertexCut)) {
        nMuons++;
+       nFWMuons++;
        if(fEPvector.Pt() > fLowPtCut) {
          nMu1GeV++; 
          if(fEPvector.Pt() > fHighPtCut) {
@@ -1394,12 +1430,22 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *
        }
       }
     }//muon track loop
+
     
     // Fill the event tags 
     if(ntrack != 0)
       meanPt = meanPt/ntrack;
-    
-    evTag->SetEventId(iEventNumber+1);
+
+    //First physics data
+    const AliMultiplicity *spdMult = esd->GetMultiplicity();
+    evTag->SetNumberOfFiredChipsLayer1(spdMult->GetNumberOfFiredChips(0));
+    evTag->SetNumberOfFiredChipsLayer2(spdMult->GetNumberOfFiredChips(1));
+    evTag->SetNumberOfSPDTracklets(spdMult->GetNumberOfTracklets());
+
+    //evTag->SetEventId(iEventNumber+1);
+    evTag->SetPeriodNumber(esd->GetPeriodNumber());
+    evTag->SetOrbitNumber(esd->GetOrbitNumber());
+    evTag->SetBunchCrossNumber(esd->GetBunchCrossNumber());
     if (vertexIn) {
       evTag->SetVertexX(vertexIn->GetXv());
       evTag->SetVertexY(vertexIn->GetYv());
@@ -1435,6 +1481,7 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *
     evTag->SetNumOfKaons(nKaons);
     evTag->SetNumOfPions(nPions);
     evTag->SetNumOfMuons(nMuons);
+    evTag->SetNumOfFWMuons(nFWMuons);
     evTag->SetNumOfElectrons(nElectrons);
     evTag->SetNumOfPhotons(nGamas);
     evTag->SetNumOfPi0s(nPi0s);
@@ -1466,6 +1513,10 @@ void AliESDTagCreator::CreateESDTags(Int_t fFirstEvent, Int_t fLastEvent, TMap *
     tag->SetRunStopTime(t2->GetDate());
     tag->SetBeamEnergy(beamenergy);
     tag->SetBeamType(beamtype);
+    
+    //QA setting 
+    tag->SetQA(qa, qalength) ; 
+    tag->SetEventSpecies(es, eslength) ;
 
     tag->AddEventTag(*evTag);
   }