// //
// V-Zero Detector //
// This class contains the base procedures for the VZERO detector //
-// Geometry of November 2003 : V0R box is now 4.4 cm thick //
-// scintillators are 2 cm thick //
+// Default geometry of November 2003 : V0R box is 4.4 cm thick //
+// scintillators are 2 cm thick //
// All comments should be sent to Brigitte CHEYNIS : //
// b.cheynis@ipnl.in2p3.fr //
// //
// --- Standard libraries ---
#include <Riostream.h>
+#include <stdlib.h>
// --- ROOT libraries ---
#include <TNamed.h>
-#include <TTree.h>
+#include "TROOT.h"
+#include "TFile.h"
+#include "TNetFile.h"
+#include "TRandom.h"
+#include "TTree.h"
+#include "TBranch.h"
+#include "TClonesArray.h"
+#include "TStopwatch.h"
// --- AliRoot header files ---
#include "AliRun.h"
#include "AliMC.h"
#include "AliVZERO.h"
#include "AliVZEROLoader.h"
+#include "AliVZERODigitizer.h"
+#include "AliVZEROBuffer.h"
+#include "AliRunDigitizer.h"
+#include "AliVZEROdigit.h"
ClassImp(AliVZERO)
// Standard constructor for VZERO Detector
//
-// fIshunt = 1; // All hits are associated with primary particles
+ // fIshunt = 1; // All hits are associated with primary particles
fHits = new TClonesArray("AliVZEROhit", 400);
fDigits = new TClonesArray("AliVZEROdigit",400);
if (fHits) {
fHits->Delete();
delete fHits;
- fHits=0;
- }
+ fHits=0; }
if (fDigits) {
fDigits->Delete();
delete fDigits;
- fDigits=0;
- }
+ fDigits=0; }
}
//_____________________________________________________________________________
//_____________________________________________________________________________
void AliVZERO::SetTreeAddress()
{
- //
+ //
// Sets tree address for hits.
//
-
if (fLoader->TreeH() && (fHits == 0x0))
fHits = new TClonesArray("AliVZEROhit", 400);
AliDetector::SetTreeAddress();
}
+//_____________________________________________________________________________
+AliDigitizer* AliVZERO::CreateDigitizer(AliRunDigitizer* manager) const
+{
+ //
+ // Creates a digitizer for VZERO
+ //
+ return new AliVZERODigitizer(manager);
+}
+
+//_____________________________________________________________________________
+void AliVZERO::Hits2Digits(){
+ //
+ // Converts hits to digits of the current event
+ //
+ // Inputs file name
+ Char_t *alifile = "galice.root";
+
+ // Create the run digitizer
+ AliRunDigitizer* manager = new AliRunDigitizer(1, 1);
+ manager->SetInputStream(0, alifile);
+ manager->SetOutputFile("H2Dfile");
+
+ // Creates the VZERO digitizer
+ AliVZERODigitizer* dig = new AliVZERODigitizer(manager);
+
+ // Creates the digits
+ dig->Exec("");
+
+}
+//_____________________________________________________________________________
+void AliVZERO::Digits2Raw()
+{
+ //
+ // Converts digits of the current event to raw data
+ //
+ AliVZERO *fVZERO = (AliVZERO*)gAlice->GetDetector("VZERO");
+ fLoader->LoadDigits();
+ TTree* digits = fLoader->TreeD();
+ if (!digits) {
+ Error("Digits2Raw", "no digits tree");
+ return;
+ }
+ TClonesArray * VZEROdigits = new TClonesArray("AliVZEROdigit",1000);
+ fVZERO->SetTreeAddress();
+ digits->GetBranch("VZERODigit")->SetAddress(&VZEROdigits);
+
+ const char *fileName = "VZERO_3584.ddl";
+ AliVZEROBuffer* buffer = new AliVZEROBuffer(fileName);
+
+ // Verbose level
+ // 0: Silent
+ // 1: cout messages
+ // 2: txt files with digits
+ // BE CAREFUL, verbose level 2 MUST be used only for debugging and
+ // it is highly suggested to use this mode only for debugging digits files
+ // reasonably small, because otherwise the size of the txt files can reach
+ // quickly several MB wasting time and disk space.
+
+ ofstream ftxt;
+ buffer->SetVerbose(0);
+ Int_t fVerbose = buffer->GetVerbose();
+
+ Int_t nEntries = Int_t(digits->GetEntries());
+
+ for (Int_t i = 0; i < nEntries; i++) {
+
+ fVZERO->ResetDigits();
+ digits->GetEvent(i);
+ Int_t ndig = VZEROdigits->GetEntriesFast();
+
+ if(ndig == 0) continue;
+ if(fVerbose == 2) {ftxt.open("VZEROdigits.txt",ios::app);}
+ for(Int_t k=0; k<ndig; k++){
+ AliVZEROdigit* fVZERODigit = (AliVZEROdigit*) VZEROdigits->At(k);
+ Int_t ADC = fVZERODigit->ADC();
+ Int_t cell = fVZERODigit->CellNumber();
+ if(fVerbose == 1) { cout <<"DDL: "<<fileName<< "\tdigit number: "<< k<<"\tcell: "
+ <<cell<<"\tADC: "<< ADC << endl;}
+ if(fVerbose == 2) {
+ ftxt<<"DDL: "<<fileName<< "\tdigit number: "<< k<<"\tcell: "
+ <<cell<<"\tADC: "<< ADC << endl;
+ }
+ buffer->WriteBinary(cell, ADC);
+ }
+ if(fVerbose==2) ftxt.close();
+ }
+
+ delete buffer;
+ fLoader->UnloadDigits();
+}
+
virtual Int_t IsVersion() const = 0;
virtual void Init();
virtual AliLoader* MakeLoader(const char* topfoldername);
+ virtual void Hits2Digits();
+ virtual void Digits2Raw();
virtual void SetTreeAddress();
virtual void MakeBranch(Option_t *option) =0;
virtual void DrawModule() {};
virtual void SetMaxDestepQua(Float_t p1);
virtual void SetMaxDestepAlu(Float_t p1);
+ AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
+
protected:
Int_t fIdSens1; // Sensitive volume in VZERO
* provided "as is" without express or implied warranty. *
**************************************************************************/
-//_________________________________________________________________________
-//
-// This constructs Digits out of Hits
-//
+///_________________________________________________________________________
+///
+/// This class constructs Digits out of Hits
+///
+///
// --- Standard library ---
-#include <Riostream.h>
-#include <stdlib.h>
// --- ROOT system ---
-#include <TFile.h>
-#include <TFolder.h>
-#include <TROOT.h>
-#include <TSystem.h>
#include <TTree.h>
-#include <TVirtualMC.h>
// --- AliRoot header files ---
#include "AliVZEROConst.h"
#include "AliRun.h"
#include "AliVZERO.h"
#include "AliVZEROhit.h"
-#include "AliHit.h"
-#include "AliDetector.h"
#include "AliRunLoader.h"
#include "AliLoader.h"
-#include "AliConfig.h"
#include "AliRunDigitizer.h"
-#include "AliDigitizer.h"
-#include "AliHeader.h"
-#include "AliStack.h"
-#include "AliVZERODigitizer.h"
#include "AliVZEROdigit.h"
-#include "AliMC.h"
+#include "AliVZERODigitizer.h"
ClassImp(AliVZERODigitizer)
AliVZERODigitizer::AliVZERODigitizer()
{
- if (!fDigits) fDigits = new TClonesArray("AliVZEROdigit", 1000);
-
- fNevents = 0 ;
- fDigits = 0 ;
+ // default constructor
+
fNdigits = 0;
- fHits = 0 ;
- fRunLoader = 0;
+ fDigits = 0 ;
fPhotoCathodeEfficiency = 0.18;
fPMVoltage = 768.0;
{
// constructor
- fNevents = 0;
- fDigits = 0;
fNdigits = 0;
- fHits = 0;
- fRunLoader = 0;
+ fDigits = 0 ;
fPhotoCathodeEfficiency = 0.18;
fPMVoltage = 768.0;
if (fDigits) {
fDigits->Delete();
delete fDigits;
- fDigits=0; }
+ fDigits=0;
+ }
}
-//____________________________________________________________________________
-void AliVZERODigitizer::OpengAliceFile(const char *file)
+//_____________________________________________________________________________
+Bool_t AliVZERODigitizer::Init()
{
- // Loads galice.root file and corresponding header, kinematics
- // hits and digits
-
- fRunLoader = AliRunLoader::Open(file,AliConfig::GetDefaultEventFolderName(),
- "UPDATE");
-
- if (!fRunLoader)
- {
- Error("Open","Can not open session for file %s.",file);
- }
-
- fRunLoader->LoadgAlice();
- fRunLoader->LoadHeader();
- fRunLoader->LoadKinematics();
+ // Initialises the digitizer
- gAlice = fRunLoader->GetAliRun();
-
- if (gAlice)
- { printf("<AliVZEROdigitizer::Open> ");
- printf("AliRun object found on file.\n");}
- else
- { printf("<AliVZEROdigitizer::Open> ");
- printf("Could not find AliRun object.\n");}
-
- // Initialise Hit and Digit arrays
- fHits = new TClonesArray ("AliVZEROhit", 1000);
+ // Initialises the Digit array
fDigits = new TClonesArray ("AliVZEROdigit", 1000);
- fVZERO = (AliVZERO*) gAlice->GetDetector("VZERO");
- fVZEROLoader = fRunLoader->GetLoader("VZEROLoader");
-
- if (fVZEROLoader == 0x0){
- cerr<<"Hits2Digits : Can not find VZERO or VZEROLoader\n";}
-
- Int_t retval = fVZEROLoader->LoadHits("read");
- if (retval){
- Error("Open","Error occured while loading hits... Exiting.");
- return;}
-
- fVZEROLoader->LoadDigits("recreate");
+ return kTRUE;
}
//____________________________________________________________________________
-void AliVZERODigitizer::Exec()
- {
-
+void AliVZERODigitizer::Exec(Option_t* /*option*/)
+{
+ //
+ // Creates digits from hits
+ //
+
fNdigits = 0;
- Int_t N;
Int_t map[96];
- Int_t cell = 0;
Float_t cPM = fPhotoCathodeEfficiency * fPMGain;
for(Int_t i=0; i<96; i++) map[i] = 0;
- fNevents = (Int_t) fRunLoader->TreeE()->GetEntries ();
- printf(" Number of events in file = %d \n", fNevents);
-
- for (Int_t ievent = 0; ievent < fNevents; ievent++){
-
- for(Int_t i=0; i<96; i++) map[i] = 0;
-
- fRunLoader->GetEvent(ievent);
+ AliRunLoader* outRunLoader =
+ AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+ if (!outRunLoader) {
+ Error("Exec", "Can not get output Run Loader");
+ return;
+ }
+ AliLoader* outLoader = outRunLoader->GetLoader("VZEROLoader");
+ if (!outLoader) {
+ Error("Exec", "Can not get output VZERO Loader");
+ return;
+ }
+
+ outLoader->LoadDigits("update");
+ if (!outLoader->TreeD()) outLoader->MakeTree("D");
+ outLoader->MakeDigitsContainer();
+ TTree* treeD = outLoader->TreeD();
+ Int_t bufsize = 16000;
+ treeD->Branch("VZERODigit", &fDigits, bufsize);
+
+ for (Int_t iInput = 0; iInput < fManager->GetNinputs(); iInput++) {
+ AliRunLoader* runLoader =
+ AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput));
+ AliLoader* loader = runLoader->GetLoader("VZEROLoader");
+ if (!loader) {
+ Error("Exec", "Can not get VZERO Loader for input %d", iInput);
+ continue;
+ }
+ if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
+
+ AliVZERO* vzero = (AliVZERO*) runLoader->GetAliRun()->GetDetector("VZERO");
+ if (!vzero) {
+ Error("Exec", "No VZERO detector for input %d", iInput);
+ continue;
+ }
- fTreeH = fVZEROLoader->TreeH();
- if (fTreeH == 0x0)
- { Error("Exec","Cannot get TreeH");
- return; }
+ loader->LoadHits();
+ TTree* treeH = loader->TreeH();
+ if (!treeH) {
+ Error("Exec", "Cannot get TreeH for input %d", iInput);
+ continue;
+ }
+ TClonesArray* hits = vzero->Hits();
- fTreeD = fVZEROLoader->TreeD();
- if (fTreeD == 0x0)
- { fVZEROLoader->MakeTree("D");
- fVZEROLoader->MakeDigitsContainer();
- fTreeD = fVZEROLoader->TreeD(); }
-
- Int_t bufsize = 16000;
- fTreeD->Branch("VZERODigit", &fDigits, bufsize);
-
-// Now make Digits from hits
-
- if (fVZERO)
- {
- fHits = fVZERO->Hits();
+// Now makes Digits from hits
- Int_t ntracks = (Int_t) fTreeH->GetEntries ();
-// printf(" Number of Tracks in the TreeH = %d \n", ntracks);
- for (Int_t track = 0; track < ntracks; track++)
- {
- gAlice->ResetHits ();
- fTreeH->GetEvent(track);
- fParticle = fRunLoader->Stack()->Particle(track);
- Int_t nhits = fHits->GetEntriesFast();
- for (Int_t hit = 0; hit < nhits; hit++)
- {
- fVZEROHit = (AliVZEROhit *)fHits->UncheckedAt(hit);
- N = fVZEROHit->Nphot();
- cell = fVZEROHit->Cell();
- map[cell] = map[cell] + N;
- } // hit loop
- } // track loop
+ Int_t nTracks = (Int_t) treeH->GetEntries();
+ for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
+ vzero->ResetHits();
+ treeH->GetEvent(iTrack);
+ Int_t nHits = hits->GetEntriesFast();
+ for (Int_t iHit = 0; iHit < nHits; iHit++) {
+ AliVZEROhit* hit = (AliVZEROhit *)hits->UncheckedAt(iHit);
+ Int_t nPhot = hit->Nphot();
+ Int_t cell = hit->Cell();
+ map[cell] += nPhot;
+ } // hit loop
+ } // track loop
+
+ loader->UnloadHits();
+
+ } // input loop
- Int_t icount = 0;
-
- for(Int_t i=0; i<96; i++) {
- Float_t q1 = Float_t ( map[i] )* cPM * kQe;
- Float_t noise = gRandom->Gaus(10.5,3.22);
- Float_t PMresponse = q1/kC*TMath::Power(ktheta/kthau,1/(1-ktheta/kthau))
- + noise*1e-3;
- map[i] = Int_t( PMresponse * 200.0);
- if(map[i] > 3) {
- icount++;
-// printf(" Event, cell, adc = %d %d %d\n", ievent, i, map[i]);
- AddDigit(ievent, i, map[i]);}
- }
-
- fTreeD->Reset();
- fTreeD->Fill();
- ResetDigit();
- fVZEROLoader->WriteDigits("OVERWRITE");
- fVZEROLoader->UnloadDigits();
- } // VZERO loop
- } //event loop
+ for (Int_t i=0; i<96; i++) {
+ Float_t q1 = Float_t ( map[i] )* cPM * kQe;
+ Float_t noise = gRandom->Gaus(10.5,3.22);
+ Float_t pmResponse = q1/kC*TMath::Power(ktheta/kthau,1/(1-ktheta/kthau))
+ + noise*1e-3;
+ map[i] = Int_t( pmResponse * 200.0);
+ if(map[i] > 3) {
+// printf(" Event, cell, adc = %d %d %d\n", outRunLoader->GetEventNumber(),i, map[i]);
+ AddDigit(i, map[i]);
+ }
+ }
+
+ treeD->Fill();
+ outLoader->WriteDigits("OVERWRITE");
+ outLoader->UnloadDigits();
+ ResetDigit();
}
//____________________________________________________________________________
-void AliVZERODigitizer::AddDigit(Int_t eventnumber, Int_t cellnumber, Int_t adc)
+void AliVZERODigitizer::AddDigit(Int_t cellnumber, Int_t adc)
{
// Adds Digit
TClonesArray &ldigits = *fDigits;
- new(ldigits[fNdigits++]) AliVZEROdigit(eventnumber,cellnumber,adc);
+ new(ldigits[fNdigits++]) AliVZEROdigit(cellnumber,adc);
}
//____________________________________________________________________________
void AliVZERODigitizer::ResetDigit()
{
+//
// Clears Digits
+//
fNdigits = 0;
- if (fDigits) fDigits->Clear();
+ if (fDigits) fDigits->Delete();
}
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-//_________________________________________________________________________
-//
-// Class for making Digits in VZERO
-//_________________________________________________________________________
+///_________________________________________________________________________
+///
+/// Class for making Digits in VZERO
+///_________________________________________________________________________
+// --- Standard library ---
+
+// --- AliRoot header files ---
+
#include "AliDigitizer.h"
-#include "TString.h"
class TClonesArray;
-class TFile;
-class TMath;
-class TObjArray;
-class TParticle;
-class TTree;
-class TNtuple;
-
-class AliLoader;
-class AliRunLoader;
-class AliRun;
-class AliDetector;
-class AliVZEROhit;
-class AliHit;
-class AliHeader;
class AliRunDigitizer;
-class AliVZEROcell;
-class AliVZEROsdigit;
-class AliVZEROdigit;
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
-
-class AliRunLoader;
class AliVZERODigitizer: public AliDigitizer {
AliVZERODigitizer(AliRunDigitizer *manager);// constructor
virtual ~AliVZERODigitizer() ; // destructor
- void OpengAliceFile(const char *file);
- char *GetDigitsFile()const{return (char*) fDigitsFile.Data();}
- virtual void Exec();
- void AddDigit(Int_t /* eventnumber */, Int_t /* cellnumber */, Int_t /* adc */);
- void SetNEvents(Int_t Nevents){fNevents = Nevents;}
+ virtual Bool_t Init();
+ virtual void Exec(Option_t* option=0);
+
+ void AddDigit(Int_t cellnumber, Int_t adc);
void ResetDigit();
- Stat_t GetNEvents(){return fNevents;}
private:
-
- Int_t fNevents; // Number of events to digitize
- Int_t fNdigits; // Number of digits
- TString fDigitsFile ; // output file
- TString fHeadersFile; // input file
+ AliVZERODigitizer(const AliVZERODigitizer& digitizer):
+ AliDigitizer(digitizer)
+ {Fatal("AliVZERODigitizer", "copy constructor not implemented");}
+ AliVZERODigitizer& operator = (const AliVZERODigitizer& /*digitizer*/)
+ {Fatal("operator=", "assignment operator not implemented"); return *this;}
Float_t fPhotoCathodeEfficiency; // Photocathode efficiency
Float_t fPMVoltage ; // Photomultiplier voltage
Float_t fPMGain; // Photomultiplier gain
- protected:
-
- AliRunLoader *fRunLoader; // Pointer to Run Loader
- AliVZEROhit *fVZEROHit; // Pointer to specific detector hits
- AliDetector *fVZERO; // Get pointers to Alice detectors
- // and Hit containers
- AliLoader *fVZEROLoader; // Pointer to specific detector loader
-
- TClonesArray *fHits; // Pointer to hit array
- TParticle *fParticle; // Pointer to a given particle
-
- TTree *fTreeH; // Hits tree
- TTree *fTreeD; // Digits tree
-
- TClonesArray *fDigits; // List of digits
+ Int_t fNdigits; //! Number of digits
+ TClonesArray *fDigits; //! List of digits
- ClassDef(AliVZERODigitizer,1)
+ ClassDef(AliVZERODigitizer,2) // digitizer for VZERO
};
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// //
+/// class for VZERO reconstruction //
+/// //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliVZEROReconstructor.h"
+
+
+ClassImp(AliVZEROReconstructor)
+
+
+//_____________________________________________________________________________
+void AliVZEROReconstructor::Reconstruct(AliRunLoader* /*runLoader*/) const
+{
+// not implemented
+
+}
+
+//_____________________________________________________________________________
+void AliVZEROReconstructor::FillESD(AliRunLoader* /*runLoader*/,
+ AliESD* /*esd*/) const
+{
+// not implemented
+
+}
--- /dev/null
+#ifndef ALIVZERORECONSTRUCTOR_H
+#define ALIVZERORECONSTRUCTOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// //
+/// class for VZERO reconstruction //
+/// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliReconstructor.h"
+
+
+class AliVZEROReconstructor: public AliReconstructor {
+public:
+ AliVZEROReconstructor(): AliReconstructor() {};
+ virtual ~AliVZEROReconstructor() {};
+
+ virtual void Reconstruct(AliRunLoader* runLoader) const;
+ virtual void FillESD(AliRunLoader* runLoader, AliESD* esd) const;
+
+ ClassDef(AliVZEROReconstructor, 0) // class for the VZERO reconstruction
+};
+
+#endif