**************************************************************************/
/* $Id$ */
-
-//Piotr.Skowronski@cern.ch :
-//Corrections applied in order to compile (only) with new I/O and folder structure
-//To be implemented correctly by responsible
-//
-// Class used to steer
-// the digitization for ITS
-//
-//
+///////////////////////////////////////////////////////////////////////////
+//Piotr.Skowronski@cern.ch : //
+//Corrections applied in order to compile (only) //
+// with new I/O and folder structure //
+//To be implemented correctly by responsible //
+// //
+// Class used to steer //
+// the digitization for ITS //
+// //
+///////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
-#include <Riostream.h>
#include <TClonesArray.h>
#include <TTree.h>
#include <TBranch.h>
-#include <AliRun.h>
-#include <AliRunLoader.h>
-#include <AliLoader.h>
-#include <AliRunDigitizer.h>
+#include "AliRun.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+#include "AliLog.h"
+#include "AliDigitizationInput.h"
#include "AliITSDigitizer.h"
-#include "AliITSpList.h"
#include "AliITSgeom.h"
+#include "AliITSgeomTGeo.h"
#include "AliITSsimulation.h"
-#include "AliITSDetType.h"
ClassImp(AliITSDigitizer)
//______________________________________________________________________
-AliITSDigitizer::AliITSDigitizer() : AliDigitizer(){
+AliITSDigitizer::AliITSDigitizer() : AliDigitizer(),
+fITS(0),
+fModActive(0),
+fInit(kFALSE),
+fRoif(-1),
+fRoiifile(0),
+fFlagFirstEv(kTRUE){
// Default constructor. Assign fITS since it is never written out from
// here.
// Inputs:
// none.
// Return:
// A blank AliITSDigitizer class.
+ fModActive = new Bool_t[AliITSgeomTGeo::GetNModules()];
+ for(Int_t i=0;i<AliITSgeomTGeo::GetNModules();i++) fModActive[i] = kTRUE;
- fITS = 0;
- fModActive = 0;
- fRoif = -1;
- fRoiifile = 0;
- fInit = kFALSE;
}
//______________________________________________________________________
-AliITSDigitizer::AliITSDigitizer(AliRunDigitizer *mngr) : AliDigitizer(mngr){
+AliITSDigitizer::AliITSDigitizer(AliDigitizationInput* digInp) : AliDigitizer(digInp),
+fITS(0),
+fModActive(0),
+fInit(kFALSE),
+fRoif(-1),
+fRoiifile(0),
+fFlagFirstEv(kTRUE){
// Standard constructor. Assign fITS since it is never written out from
// here.
// Inputs:
// none.
// Return:
// An AliItSDigitizer class.
-
- fITS = 0;
- fModActive = 0;
- fRoif = -1;
- fRoiifile = 0;
- fInit = kFALSE;
+ fModActive = new Bool_t[AliITSgeomTGeo::GetNModules()];
+ for(Int_t i=0;i<AliITSgeomTGeo::GetNModules();i++) fModActive[i] = kTRUE;
}
+
+
//______________________________________________________________________
AliITSDigitizer::~AliITSDigitizer(){
// Default destructor.
// none.
// Return:
// none.
-
fITS = 0; // don't delete fITS. Done else where.
if(fModActive) delete[] fModActive;
}
fInit = kFALSE;
Warning("Init","ITS not found");
return fInit;
- } else if(fITS->GetITSgeom()){
- //cout << "fRoif,fRoiifile="<<fRoif<<" "<<fRoiifile<<endl;
- fModActive = new Bool_t[fITS->GetITSgeom()->GetIndexMax()];
- } else{
+ }
+ if(!fITS->GetITSgeom()){
fRoiifile = 0;
fInit = kFALSE;
Warning("Init","ITS geometry not found");
return fInit;
} // end if
- // fModActive needs to be set to a default all kTRUE value
- for(Int_t i=0;i<fITS->GetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE;
return fInit;
}
//______________________________________________________________________
-void AliITSDigitizer::Exec(Option_t* opt){
+void AliITSDigitizer::Digitize(Option_t* opt){
// Main digitization function.
// Inputs:
// Option_t * opt list of sub detector to digitize. =0 all.
// Return:
// none.
- char name[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ char name[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
const char *all;
const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
strstr(opt,"SSD")};
if( !det[0] && !det[1] && !det[2] ) all = "All";
else all = 0;
+ Int_t nfiles = GetDigInput()->GetNinputs();
+ Int_t event = GetDigInput()->GetOutputEventNr();
AliITSsimulation *sim = 0;
- AliITSDetType *iDetType = 0;
- static Bool_t setDef = kTRUE;
-
+ if(fFlagFirstEv){
+ fITS->SetDefaults();
+ fITS->SetDefaultSimulation();
+ fFlagFirstEv=kFALSE;
+ }
if(!fInit){
- Error("Exec","Init not succesfull, aborting.");
+ Error("Exec","Init not successful, aborting.");
return;
} // end if
- if( setDef ) fITS->SetDefaultSimulation();
- setDef = kFALSE;
- sprintf(name,"%s",fITS->GetName());
+ snprintf(name,20,"%s",fITS->GetName());
- Int_t nfiles = GetManager()->GetNinputs();
- Int_t event = GetManager()->GetOutputEventNr();
Int_t size = fITS->GetITSgeom()->GetIndexMax();
Int_t module,id,ifiles,mask;
Bool_t lmod;
AliRunLoader *inRL = 0x0, *outRL = 0x0;
AliLoader *ingime = 0x0, *outgime = 0x0;
- outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+ outRL = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
if ( outRL == 0x0)
{
Error("Exec","Can not get Output Run Loader");
+ delete [] fl;
return;
}
outRL->GetEvent(event);
if ( outgime == 0x0)
{
Error("Exec","Can not get Output ITS Loader");
+ delete [] fl;
return;
}
+
outgime->LoadDigits("update");
if (outgime->TreeD() == 0x0) outgime->MakeTree("D");
// Digitize
fITS->MakeBranchInTreeD(outgime->TreeD());
- if(fRoif!=0) Info("AliITSDigitizer","Region of Interest digitization selected");
- else Info("AliITSDigitizer","No Region of Interest selected. Digitizing everything");
- //cout <<"fModActive="<<fModActive<<" fRoif="<<fRoif;
- if(fModActive==0) fRoif = 0; // fModActive array must be define for RIO cuts.
- //cout <<" fRoif="<<fRoif<<endl;
+ if(fRoif!=0) {
+ AliDebug(1,"Region of Interest digitization selected");
+ }
+ else {
+ AliDebug(1,"No Region of Interest selected. Digitizing everything");
+ }
+
for(ifiles=0; ifiles<nfiles; ifiles++ )
{
- inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(fl[ifiles]));
+ inRL = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(fl[ifiles]));
ingime = inRL->GetLoader(loadname);
if (ingime->TreeS() == 0x0) ingime->LoadSDigits();
}
for(module=0; module<size; module++ )
{
- if(fModActive && fRoif!=0) if(!fModActive[module]) continue;
- id = fITS->GetITSgeom()->GetModuleType(module);
- if(!all && !det[id]) continue;
- iDetType = fITS->DetType( id );
-
- sim = (AliITSsimulation*)iDetType->GetSimulationModel();
- if(!sim) {
+ if(fRoif!=0) if(!fModActive[module]) continue;
+ id = fITS->GetITSgeom()->GetModuleType(module);
+ if(!all && !det[id]) continue;
+ sim = (AliITSsimulation*)fITS->GetSimulationModel(id);
+ if(!sim) {
Error( "Exec", "The simulation class was not instanciated!" );
exit(1);
} // end if !sim
-
- // Fill the module with the sum of SDigits
+ // Fill the module with the sum of SDigits
sim->InitSimulationModule(module, event);
//cout << "Module=" << module;
for(ifiles=0; ifiles<nfiles; ifiles++ )
{
if(fRoif!=0) if(!fModActive[module]) continue;
- inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(fl[ifiles]));
+ inRL = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(fl[ifiles]));
ingime = inRL->GetLoader(loadname);
TTree *treeS = ingime->TreeS();
fITS->SetTreeAddress();
- if( !(treeS && fITS->GetSDigits()) ) continue;
+ if( !treeS ) continue;
TBranch *brchSDigits = treeS->GetBranch( name );
if( brchSDigits )
{
} else {
Error( "Exec", "branch ITS not found in TreeS, input file %d ",
ifiles );
+ delete [] fl;
return;
} // end if brchSDigits
sdig->Clear();
- mask = GetManager()->GetMask(ifiles);
+ mask = GetDigInput()->GetMask(ifiles);
// add summable digits to module
brchSDigits->GetEvent( module );
lmod = sim->AddSDigitsToModule(sdig,mask);
- if(ifiles==0)
+ if(GetRegionOfInterest() && (ifiles==0))
{
fModActive[module] = lmod;
} // end if
} // end for ifiles
//cout << " end ifiles loop" << endl;
// Digitize current module sum(SDigits)->Digits
- sim->FinishSDigitiseModule();
+ sim->FinishSDigitiseModule();
// fills all branches - wasted disk space
outgime->TreeD()->Fill();
- fITS->ResetDigits();
+ fITS->ResetDigits();
} // end for module
-
+ fITS->WriteFOSignals();
outgime->TreeD()->AutoSave();
outgime->WriteDigits("OVERWRITE");
outgime->UnloadDigits();
-
for(ifiles=0; ifiles<nfiles; ifiles++ )
{
- inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(fl[ifiles]));
+ inRL = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(fl[ifiles]));
ingime = inRL->GetLoader(loadname);
ingime->UnloadSDigits();
}
sdig->Clear();
delete sdig;
for(Int_t i=0;i<fITS->GetITSgeom()->GetIndexMax();i++) fModActive[i] = kTRUE;
+
+
return;
}
//______________________________________________________________________
nm = fITS->GetITSgeom()->GetIndexMax();
for(m=0;m<nm;m++){
- //cout << " fModActive["<<m<<"]=";
fModActive[m] = kFALSE; // Not active by default
sdig->Clear();
brchSDigits->GetEvent(m);
//cout << fModActive[m];
//cout << endl;
} // end for m
- Info("AliITSDigitizer","Digitization by Region of Interest selected");
+ AliDebug(1,"Digitization by Region of Interest selected");
sdig->Clear();
delete sdig;
return;