#include <TString.h>
#include <TTree.h>
#include <TVirtualMC.h>
+#include <TArrayI.h>
#include "AliDetector.h"
#include "AliITS.h"
#include "AliITSDetTypeSim.h"
#include "AliITSRecPoint.h"
#include "AliITSsegmentationSPD.h"
#include "AliITSsegmentationSDD.h"
+#include "AliITSsimulationSDD.h"
+#include "AliITSCalibrationSDD.h"
+#include "AliITSCalibrationSSD.h"
#include "AliITSsegmentationSSD.h"
#include "AliITSRawStreamSPD.h"
#include "AliITSRawStreamSSD.h"
#include "AliITSRawStreamSDD.h"
-#include "AliITSresponseSDD.h"
#include "AliRawReader.h"
#include "AliRun.h"
#include "AliLog.h"
#include "AliITSInitGeometry.h"
+#include "AliITSFOSignalsSPD.h"
ClassImp(AliITS)
fIdSens(0),
fIdName(0),
fITSmodules(0),
-fTiming(kFALSE)
+fTiming(kFALSE),
+fSimuParam(0),
+fModA(0),
+fpSDigits(0)
{
// Default initializer for ITS
// The default constructor of the AliITS class. In addition to
// SetDetectors(); // default to fOpt="All". This variable not written out.
//PH SetMarkerColor(kRed);
+ for (int i=fgkNTYPES;i--;) fkRawID2ClusID[i] = 0;
}
//______________________________________________________________________
-AliITS::AliITS(const Char_t *title):AliDetector("ITS",title),
-fDetTypeSim(0),
-fEuclidOut(0),
-fOpt("All"),
-fIdN(0),
-fIdSens(0),
-fIdName(0),
-fITSmodules(0),
-fTiming(kFALSE)
+AliITS::AliITS(const Char_t *title):
+ AliDetector("ITS",title),
+ fDetTypeSim(0),
+ fEuclidOut(0),
+ fOpt("All"),
+ fIdN(0),
+ fIdSens(0),
+ fIdName(0),
+ fITSmodules(0),
+ fTiming(kFALSE),
+ fSimuParam(0),
+ fModA(0),
+ fpSDigits(0)
{
// The standard Constructor for the ITS class.
// It also zeros the variables
//PH SetMarkerColor(kRed);
if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ for (int i=fgkNTYPES;i--;) fkRawID2ClusID[i] = 0;
}
//______________________________________________________________________
-AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
-fDetTypeSim(0),
-fEuclidOut(0),
-fOpt("All"),
-fIdN(0),
-fIdSens(0),
-fIdName(0),
-fITSmodules(0),
-fTiming(kFALSE)
+AliITS::AliITS(const char *name, const char *title):
+ AliDetector(name,title),
+ fDetTypeSim(0),
+ fEuclidOut(0),
+ fOpt("All"),
+ fIdN(0),
+ fIdSens(0),
+ fIdName(0),
+ fITSmodules(0),
+ fTiming(kFALSE),
+ fSimuParam(0),
+ fModA(0),
+ fpSDigits(0)
{
// The standard Constructor for the ITS class.
// It also zeros the variables
SetDetectors(); // default to fOpt="All". This variable not written out.
fDetTypeSim = new AliITSDetTypeSim();
-
//PH SetMarkerColor(kRed);
if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
-
+ for (int i=fgkNTYPES;i--;) fkRawID2ClusID[i] = 0;
}
//______________________________________________________________________
AliITS::~AliITS(){
delete[] fIdName; // Array of TStrings
delete[] fIdSens;
-
+ Int_t size = AliITSgeomTGeo::GetNModules();
if (fDetTypeSim){
delete fDetTypeSim;
fDetTypeSim = 0;
}
+ if(fSimuParam){
+ delete fSimuParam;
+ fSimuParam=0;
+ }
+ if(fModA){
+ if(size>0){
+ for(Int_t j=0; j<size; j++){
+ fModA[j]->Delete();
+ delete fModA[j];
+ }
+ }
+ delete []fModA;
+ }
+ if(fpSDigits){
+ fpSDigits->Delete();
+ delete fpSDigits;
+ }
}
+
//______________________________________________________________________
-AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager)const{
+AliDigitizer* AliITS::CreateDigitizer(AliDigitizationInput* digInput)const{
// Creates the AliITSDigitizer in a standard way for use via AliModule.
// This function can not be included in the .h file because of problems
// with the order of inclusion (recursive).
// Inputs:
- // AliRunDigitizer *manager The Manger class for Digitization
+ // AliDigitizationInput* digInput The Manger class for Digitization
// Output:
// none.
// Return:
// A new AliITSRunDigitizer (cast as a AliDigitizer).
- return new AliITSDigitizer(manager);
+ return new AliITSDigitizer(digInput);
}
//______________________________________________________________________
void AliITS::Init(){
// none.
Int_t i;
// Array of TStrings
- if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
+ if(TVirtualMC::GetMC()) for(i=0;i<fIdN;i++) fIdSens[i] = TVirtualMC::GetMC()->VolId(fIdName[i]);
}
-
-
//______________________________________________________________________
void AliITS::SetDefaults(){
// sets the default segmentation, response, digit and raw cluster classes.
}
fDetTypeSim->SetDefaults();
-
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
}
//______________________________________________________________________
}
fDetTypeSim->SetDefaultSimulation();
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
}
Error("MakeBranchS","fDetTypeSim is 0!");
}
Int_t buffersize = 4000;
- char branchname[30];
+ char branchname[31];
// only one branch for SDigits.
- sprintf(branchname,"%s",GetName());
+ snprintf(branchname,30,"%s",GetName());
if(fLoader->TreeS()){
TClonesArray* sdig = (TClonesArray*)fDetTypeSim->GetSDigits();
return;
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
MakeBranchInTreeD(fLoader->TreeD(),file);
}
Error("MakeBranchS","fDetTypeSim is 0!");
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
const Char_t *det[3] = {"SPD","SDD","SSD"};
- Char_t* digclass;
+ const Char_t* digclass;
Int_t buffersize = 4000;
- Char_t branchname[30];
+ Char_t branchname[31];
if(!fDetTypeSim->GetDigits()){
fDetTypeSim->SetDigits(new TObjArray(fgkNTYPES));
(fDetTypeSim->GetDigits())->AddAt(new TClonesArray(classn.Data(),1000),i);
}
else ResetDigits(i);
- if(fgkNTYPES==3) sprintf(branchname,"%sDigits%s",GetName(),det[i]);
+ if(fgkNTYPES==3) snprintf(branchname,30,"%sDigits%s",GetName(),det[i]);
else sprintf(branchname,"%sDigits%d",GetName(),i+1);
TObjArray* dig = DigitsAddress(i);
if(GetDigits() && treeD) AliDetector::MakeBranchInTree(treeD,branchname, &dig,buffersize,file);
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
TTree *treeS = fLoader->TreeS();
TTree *treeD = fLoader->TreeD();
}
//______________________________________________________________________
-void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
+void AliITS::FillModules(Int_t /* evnt */,Int_t bgrev,Int_t /* nmodules */,
Option_t *option, const char *filename){
// fill the modules with the sorted by module hits; add hits from
// background if option=Add.
static TFile *file;
const char *addBgr = strstr(option,"Add");
- evnt = nmodules; // Dummy use of variables to remove warnings
if (addBgr ) {
if(first) {
file=new TFile(filename);
if(trH1) delete trH1;
trH1=0;
- char treeName[20];
- sprintf(treeName,"TreeH%d",bgrev);
+ char treeName[21];
+ snprintf(treeName,20,"TreeH%d",bgrev);
trH1 = (TTree*)gDirectory->Get(treeName);
if (!trH1) {
Error("FillModules","cannot find Hits Tree for event:%d",bgrev);
FillModules(trH1,10000000); // Default mask 10M.
TTree *fAli=fLoader->GetRunLoader()->TreeK();
TFile *fileAli=0;
- if (fAli) fileAli =fAli->GetCurrentFile();
- fileAli->cd();
+ if (fAli) {
+ fileAli =fAli->GetCurrentFile();
+ fileAli->cd();
+ }
} // end if add
}
-
-
//______________________________________________________________________
void AliITS::FillModules(TTree *treeH, Int_t mask) {
// fill the modules with the sorted by module hits;
if (treeH == 0x0)
{
- Error("FillModules","Tree is NULL");
+ AliError("Tree H is NULL");
+ return;
}
Int_t lay,lad,det,index;
AliITShit *itsHit=0;
AliITSmodule *mod=0;
- char branchname[20];
- sprintf(branchname,"%s",GetName());
+ char branchname[21];
+ snprintf(branchname,20,"%s",GetName());
TBranch *branch = treeH->GetBranch(branchname);
if (!branch) {
Error("FillModules","%s branch in TreeH not found",branchname);
Error("InitModules","fDetTypeSim is null!");
return kFALSE;
}
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
Int_t nl,indexMAX,index;
if(!fDetTypeSim) {
Error("Hits2SDigits","fDetTypeSim is null!");
- return;
-
+ return;
}
SetDefaults();
fLoader->LoadSDigits("recreate");
AliRunLoader* rl = fLoader->GetRunLoader();
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
+
for (Int_t iEvent = 0; iEvent < rl->GetNumberOfEvents(); iEvent++) {
// Do the Hits to Digits operation. Use Standard input values.
// Event number from file, no background hit merging , use size from
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
SetDefaults();
fLoader->LoadHits("read");
return;
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
if(!GetITSgeom()) return; // need transformations to do digitization.
AliITSgeom *geom = GetITSgeom();
Int_t nmodules;
InitModules(size,nmodules);
FillModules(evNumber,bgrev,nmodules,option,filename);
+
+ // Reset Fast-OR signals for this event
+ fDetTypeSim->ResetFOSignals();
AliITSsimulation *sim = 0;
AliITSmodule *mod = 0;
} // end for module
ClearModules();
+
+ // Add Fast-OR signals to event (only one object per event)
+ if (all || det[0]) { // SPD present
+ WriteFOSignals();
+ }
fLoader->TreeD()->GetEntries();
fLoader->TreeD()->AutoSave();
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
SetDefaults();
HitsToPreDigits(fLoader->GetRunLoader()->GetEventNumber(),
return;
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
if(!GetITSgeom()){
Error("HitsToPreDigits","fGeom is null!");
sim = (AliITSsimulation*)GetSimulationModel(id);
if (!sim) {
Error("HitsToFastPoints","The simulation class was not "
- "instanciated for module %d type %x!",module,
+ "instantiated for module %d type %s!",module,
geom->GetModuleTypeName(module));
exit(1);
} // end if !sim
mod = (AliITSmodule *)fITSmodules->At(module);
sim->CreateFastRecPoints(mod,module,gRandom,ptarray);
lTR->Fill();
+ ptarray->Clear();
} // end for module
ClearModules();
points->Clear();
}
- Info("Hits2Clusters","Number of found fast clusters : %d",ncl);
+ AliDebug(1,Form("Number of found fast clusters : %d",ncl));
//cTree->Write();
//______________________________________________________________________
void AliITS::SDigitsToDigits(Option_t *opt){
- // Standard Summable digits to Digits function.
- // Inputs:
- // none.
- // Outputs:
- // none.
- if(!fDetTypeSim) {
- Error("SDigitsToSDigits","fDetTypeSim is 0!");
- return;
- }
-
- fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
- SetDefaults();
- fDetTypeSim->SDigitsToDigits(opt,(Char_t*)GetName());
+ // Standard Summable digits to Digits function.
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ if (!fDetTypeSim) {
+ AliError("fDetTypeSim is 0!");
+ return;
+ }
+ const char *all = strstr(opt,"All");
+ const char *det[3] ={strstr(opt,"SPD"),strstr(opt,"SDD"),
+ strstr(opt,"SSD")};
+
+ // Reset Fast-OR signals for this event
+ fDetTypeSim->ResetFOSignals();
+
+ fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+ SetDefaults();
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
+ fDetTypeSim->SDigitsToDigits(opt,(Char_t*)GetName());
+ // Add Fast-OR signals to event (only one object per event)
+ if (all || det[0]) { // SPD present
+ WriteFOSignals();
+ }
}
//______________________________________________________________________
}
fDetTypeSim->AddSumDigit(sdig);
-}
-//______________________________________________________________________
-void AliITS::AddRealDigit(Int_t branch, Int_t *digits){
- // Add a real digit - as coming from data.
- // Inputs:
- // Int_t id Detector type number.
- // Int_t *digits Integer array containing the digits info. See
- // AliITSdigit.h
- // Outputs:
- // none.
- // Return:
- // none.
-
- if(!fDetTypeSim) {
- Error("AddRealDigit","fDetTypeSim is 0!");
- return;
- }
- fDetTypeSim->AddRealDigit(branch,digits);
-
}
//______________________________________________________________________
void AliITS::AddSimDigit(Int_t branch, AliITSdigit *d){
}
fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
SetDefaults();
+ if(fSimuParam) fDetTypeSim->SetSimuParam(fSimuParam);
fDetTypeSim->GetLoader()->LoadDigits();
TTree* digits = fDetTypeSim->GetLoader()->TreeD();
if (!digits) {
return;
}
fDetTypeSim->SetTreeAddressD(digits,(Char_t*)GetName());
+
+ // Get the FO signals for this event
+ AliITSFOSignalsSPD* foSignals = NULL;
+ AliRunLoader* runLoader = AliRunLoader::Instance();
+ AliITSLoader* itsLoader = (AliITSLoader*) runLoader->GetLoader("ITSLoader");
+ if (!itsLoader) {
+ AliError("ITS loader is NULL.");
+ }
+ else {
+ if(!itsLoader->TreeD()) AliError(" !!! No TreeD available !!!");
+ foSignals = (AliITSFOSignalsSPD*)itsLoader->TreeD()->GetUserInfo()->FindObject("AliITSFOSignalsSPD");
+ if(!foSignals) AliError("FO signals not retrieved");
+ }
+
+ Bool_t deleteFOsignalsLater = kFALSE;
+ if (!foSignals) {
+ AliError("FO signals not available. No FO bits will be written.");
+ foSignals = new AliITSFOSignalsSPD(); // make a temporary dummy signals object
+ deleteFOsignalsLater = kTRUE;
+ }
+
+
AliITSDDLModuleMapSDD* ddlsdd=fDetTypeSim->GetDDLModuleMapSDD();
-
+ Char_t rawSDD=fDetTypeSim->GetSimuParam()->GetSDDRawDataFormat();
AliITSDDLRawData rawWriter;
+
+ rawWriter.SetSDDRawFormat(rawSDD);
//Verbose level
// 0: Silent
// 1: cout messages
rawWriter.SetVerbose(0);
//SILICON PIXEL DETECTOR
- Info("Digits2Raw", "Formatting raw data for SPD");
- rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD"));
+ AliDebug(1,"Formatting raw data for SPD");
+ rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD"),foSignals);
+ if(deleteFOsignalsLater) delete foSignals;
//SILICON DRIFT DETECTOR
- Info("Digits2Raw", "Formatting raw data for SDD");
+ AliDebug(1,Form("Formatting raw data for SDD - Format code =%d",rawSDD));
rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"),ddlsdd);
//SILICON STRIP DETECTOR
- Info("Digits2Raw", "Formatting raw data for SSD");
+ AliDebug(1,"Formatting raw data for SSD");
rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD"));
fLoader->UnloadDigits();
fLoader = new AliITSLoader(GetName(),topfoldername);
return fLoader;
}
-
+//______________________________________________________________________
Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
{
//
//
// Get TreeS
//
- Int_t last = -1;
- Int_t size = GetITSgeom()->GetIndexMax();
- TClonesArray** modA = new TClonesArray*[size];
- for (Int_t mod = 0; mod < size; mod++) modA[mod] = new TClonesArray("AliITSpListItem", 10000);
-
- AliLoader* loader = (gAlice->GetRunLoader())->GetLoader("ITSLoader");
- if (!loader)
- {
- Error("Open","Can not get ITS loader from Run Loader");
- return kFALSE;
- }
+ Int_t last = -1;
+ Int_t size = AliITSgeomTGeo::GetNModules();
+ if(!fModA) {
+ fModA = new TClonesArray*[size];
+ for (Int_t mod = 0; mod < size; mod++) fModA[mod] = new TClonesArray("AliITSpListItem", 10000);
+ }
+ AliLoader* loader = (AliRunLoader::Instance())->GetLoader("ITSLoader");
+ if (!loader){
+ Error("Open","Can not get ITS loader from Run Loader");
+ return kFALSE;
+ }
- TTree* tree = 0;
+ TTree* tree = 0;
+ tree = loader->TreeS();
+ if (!tree){
+ loader->MakeTree("S");
tree = loader->TreeS();
- if (!tree)
- {
- loader->MakeTree("S");
- tree = loader->TreeS();
- }
- //
- // Array for SDigits
- //
- TClonesArray aSDigits("AliITSpListItem",10000), *itsSDigits=&aSDigits;
- Int_t bufsize = 32000;
- tree->Branch("ITS", &itsSDigits, bufsize);
- Int_t npx = 0;
- //
- // SPD
- //
- AliITSsegmentationSPD* segSPD = (AliITSsegmentationSPD*) fDetTypeSim->GetSegmentationModel(0);
- if(!segSPD){
- AliWarning("Set AliITS defaults");
- SetDefaults();
- segSPD = (AliITSsegmentationSPD*) fDetTypeSim->GetSegmentationModel(0);
+ }
+ //
+ // Array for SDigits
+ //
+ if(!fpSDigits){
+ fpSDigits = new TClonesArray("AliITSpListItem",10000);
+ }
+ TClonesArray& aSDigits = *fpSDigits;
+ Int_t bufsize = 32000;
+ tree->Branch("ITS", &fpSDigits, bufsize);
+ Int_t npx = 0;
+ //
+ // SPD
+ //
+ AliITSsegmentationSPD* segSPD = (AliITSsegmentationSPD*) fDetTypeSim->GetSegmentationModel(0);
+ if(!segSPD){
+ AliWarning("Set AliITS defaults");
+ SetDefaults();
+ segSPD = (AliITSsegmentationSPD*) fDetTypeSim->GetSegmentationModel(0);
+ }
+ npx = segSPD->Npx();
+ Double_t thr, sigma;
+
+ Int_t countRW = -1; // RS counter for raw -> cluster ID's (used in embedding)
+ const TArrayI* rawID2clusID = fkRawID2ClusID[kSPD];
+ AliITSRawStreamSPD inputSPD(rawReader);
+ while(1){
+ Bool_t next = inputSPD.Next();
+ if (!next) break;
+
+ countRW++; // RS
+ Int_t module = inputSPD.GetModuleID();
+ Int_t column = inputSPD.GetColumn();
+ Int_t row = inputSPD.GetRow();
+ Int_t index = npx * column + row;
+
+ if (module >= size) continue;
+
+ last = (fModA[module])->GetEntries();
+ TClonesArray& dum = *fModA[module];
+ fDetTypeSim->GetSimuParam()->SPDThresholds(module,thr,sigma);
+ thr += 1.;
+ int label = kMaxLabel;
+ if (rawID2clusID) { // RS If the raw->cluster ID is set (filled by cluster finder) store cluster ID's in SDigits
+ if (rawID2clusID->GetSize()<=countRW) {AliError(Form("The buffer of rawSPD to clusSPD ID's is shorter than current rawSPD ID=%d",countRW));}
+ else label = (*rawID2clusID)[countRW];
}
- npx = segSPD->Npx();
- Double_t thr, sigma;
-
- AliITSRawStreamSPD inputSPD(rawReader);
- while(1){
- Bool_t next = inputSPD.Next();
- if (!next) break;
-
- Int_t module = inputSPD.GetModuleID();
- Int_t column = inputSPD.GetColumn();
- Int_t row = inputSPD.GetRow();
- Int_t index = npx * column + row;
+ new (dum[last]) AliITSpListItem(label, -1, module, index, thr);
+ }
+ rawReader->Reset();
- if (module >= size) continue;
-
- last = (modA[module])->GetEntries();
- TClonesArray& dum = *modA[module];
- fDetTypeSim->GetCalibrationModel(module)->Thresholds(thr,sigma);
- thr += 1.;
- new (dum[last]) AliITSpListItem(-1, -1, module, index, thr);
+ //
+ // SDD
+ //
+ AliITSsegmentationSDD* segSDD = (AliITSsegmentationSDD*) fDetTypeSim->GetSegmentationModel(1);
+ npx = segSDD->Npx();
+ Int_t scalef=AliITSsimulationSDD::ScaleFourier(segSDD);
+ Int_t firstSDD=AliITSgeomTGeo::GetModuleIndex(3,1,1);
+ Int_t firstSSD=AliITSgeomTGeo::GetModuleIndex(5,1,1);
+ //
+ countRW = -1; // RS
+ rawID2clusID = fkRawID2ClusID[kSDD];
+ AliITSRawStream* inputSDD=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
+ for(Int_t iMod=firstSDD; iMod<firstSSD; iMod++){
+ AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)fDetTypeSim->GetCalibrationModel(iMod);
+ Bool_t isZeroSupp=cal->GetZeroSupp();
+ if(isZeroSupp){
+ for(Int_t iSid=0; iSid<2; iSid++) inputSDD->SetZeroSuppLowThreshold(iMod-firstSDD,iSid,cal->GetZSLowThreshold(iSid));
+ }else{
+ for(Int_t iSid=0; iSid<2; iSid++) inputSDD->SetZeroSuppLowThreshold(iMod-firstSDD,iSid,0);
}
- rawReader->Reset();
-
- //
- // SDD
- //
- AliITSsegmentationSDD* segSDD = (AliITSsegmentationSDD*) fDetTypeSim->GetSegmentationModel(1);
- npx = segSDD->Npx();
- AliITSRawStreamSDD inputSDD(rawReader);
- AliITSDDLModuleMapSDD* ddlmap=fDetTypeSim->GetDDLModuleMapSDD();
- inputSDD.SetDDLModuleMap(ddlmap);
- while(1){
- Bool_t next = inputSDD.Next();
- if (!next) break;
-
- Int_t module = inputSDD.GetModuleID();
- Int_t anode = inputSDD.GetAnode();
- Int_t time = inputSDD.GetTime();
- Int_t signal10 = inputSDD.GetSignal();
- Int_t index = npx * anode + time;
-
- if (module >= size) continue;
- /* 8->10 bit expansion is done in AliITSRawStreamSDD
- // 8bit -> 10 bit
- AliITSresponseSDD *resSDD = (AliITSresponseSDD*) fDetTypeSim->GetResponse(1);
- Int_t signal10 = resSDD->Convert8to10(signal); // signal is a 8 bit value (if the compression is active)
- */
- last = modA[module]->GetEntries();
- TClonesArray& dum = *modA[module];
- new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal10));
- ((AliITSpListItem*) dum.At(last))->AddSignalAfterElect(module, index, Double_t(signal10));
-
+ }
+
+ AliITSDDLModuleMapSDD* ddlmap=fDetTypeSim->GetDDLModuleMapSDD();
+ inputSDD->SetDDLModuleMap(ddlmap);
+ while(inputSDD->Next()){
+ countRW++; // RS
+ if(inputSDD->IsCompletedModule()==kFALSE &&
+ inputSDD->IsCompletedDDL()==kFALSE){
+
+ Int_t module = inputSDD->GetModuleID();
+ Int_t anode = inputSDD->GetCoord1()+segSDD->NpzHalf()*inputSDD->GetChannel();
+ Int_t time = inputSDD->GetCoord2();
+ Int_t signal10 = inputSDD->GetSignal();
+ Int_t index = AliITSpList::GetIndex(anode,time,scalef*npx);
+
+ if (module >= size) continue;
+ last = fModA[module]->GetEntries();
+ TClonesArray& dum = *fModA[module];
+ int label = kMaxLabel;
+ if (rawID2clusID) { // RS If the raw->cluster ID is set (filled by cluster finder) store cluster ID's in SDigits
+ if (rawID2clusID->GetSize()<=countRW) {AliError(Form("The buffer of rawSDD to clusSDD ID's is shorter than current rawSDD ID=%d",countRW));}
+ else label = (*rawID2clusID)[countRW];
+ }
+ new (dum[last]) AliITSpListItem(label, -1, module, index, Double_t(signal10));
+ ((AliITSpListItem*) dum.At(last))->AddSignalAfterElect(module, index, Double_t(signal10));
}
- rawReader->Reset();
-
- //
- // SSD
- //
- AliITSsegmentationSSD* segSSD = (AliITSsegmentationSSD*) fDetTypeSim->GetSegmentationModel(2);
- npx = segSSD->Npx();
- AliITSRawStreamSSD inputSSD(rawReader);
- while(1){
- Bool_t next = inputSSD.Next();
- if (!next) break;
-
- Int_t module = inputSSD.GetModuleID();
- Int_t side = inputSSD.GetSideFlag();
- Int_t strip = inputSSD.GetStrip();
- Int_t signal = inputSSD.GetSignal();
- Int_t index = npx * side + strip;
-
- if (module >= size) continue;
+ }
+ delete inputSDD;
+ rawReader->Reset();
+
+ //
+ // SSD
+ //
+ AliITSsegmentationSSD* segSSD = (AliITSsegmentationSSD*) fDetTypeSim->GetSegmentationModel(2);
+ npx = segSSD->Npx();
+ AliITSRawStreamSSD inputSSD(rawReader);
+ countRW = -1;
+ rawID2clusID = fkRawID2ClusID[kSSD];
+ while(1){
+ Bool_t next = inputSSD.Next();
+ if (!next) break;
+ countRW++; // RS
+ Int_t module = inputSSD.GetModuleID();
+ if(module<0)AliError(Form("Invalid SSD module %d \n",module));
+ if(module<0)continue;
+ Int_t side = inputSSD.GetSideFlag();
+ Int_t strip = inputSSD.GetStrip();
+ Int_t signal = inputSSD.GetSignal();
+ Int_t index = npx * side + strip;
+
+ if (module >= size) continue;
- last = modA[module]->GetEntries();
- TClonesArray& dum = *modA[module];
- new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal));
- }
- rawReader->Reset();
- AliITSpListItem* sdig = 0;
+ last = fModA[module]->GetEntries();
+ TClonesArray& dum = *fModA[module];
+ int label = kMaxLabel;
+ if (rawID2clusID) { // RS If the raw->cluster ID is set (filled by cluster finder) store cluster ID's in SDigits
+ if (rawID2clusID->GetSize()<=countRW) {AliError(Form("The buffer of rawSSD to clusSSD ID's is shorter than current rawSSD ID=%d",countRW));}
+ else label = (*rawID2clusID)[countRW];
+ }
+ new (dum[last]) AliITSpListItem(label, -1, module, index, Double_t(signal));
+ }
+ rawReader->Reset();
+ AliITSpListItem* sdig = 0;
- for (Int_t mod = 0; mod < size; mod++)
+ Int_t firstssd = GetITSgeom()->GetStartDet(kSSD);
+ Double_t adcToEv = 1.;
+ for (Int_t mod = 0; mod < size; mod++)
{
- Int_t nsdig = modA[mod]->GetEntries();
- for (Int_t ie = 0; ie < nsdig; ie++) {
- sdig = (AliITSpListItem*) (modA[mod]->At(ie));
- new (aSDigits[ie]) AliITSpListItem(-1, -1, mod, sdig->GetIndex(), sdig->GetSignal());
- Float_t sig = sdig->GetSignalAfterElect();
- if (sig > 0.) {
- sdig = (AliITSpListItem*)aSDigits[ie];
- sdig->AddSignalAfterElect(mod, sdig->GetIndex(), Double_t(sig));
- }
+ if(mod>=firstssd) {
+ AliITSCalibrationSSD* calssd = (AliITSCalibrationSSD*)fDetTypeSim->GetCalibrationModel(mod);
+ adcToEv = 1./calssd->GetSSDDEvToADC(1.);
+ }
+ Int_t nsdig = fModA[mod]->GetEntries();
+ for (Int_t ie = 0; ie < nsdig; ie++) {
+ sdig = (AliITSpListItem*) (fModA[mod]->At(ie));
+ Double_t digsig = sdig->GetSignal();
+ if(mod>=firstssd) digsig*=adcToEv; // for SSD: convert back charge from ADC to electron
+ new (aSDigits[ie]) AliITSpListItem(sdig->GetTrack(0), -1, mod, sdig->GetIndex(), digsig);
+ Float_t sig = sdig->GetSignalAfterElect();
+ if(mod>=firstssd) sig*=adcToEv;
+ if (sig > 0.) {
+ sdig = (AliITSpListItem*)aSDigits[ie];
+ sdig->AddSignalAfterElect(mod, sdig->GetIndex(), Double_t(sig));
}
+ }
- tree->Fill();
- aSDigits.Clear();
- modA[mod]->Clear();
+ tree->Fill();
+ aSDigits.Clear();
+ fModA[mod]->Clear();
}
- loader->WriteSDigits("OVERWRITE");
- delete modA;
- return kTRUE;
+ loader->WriteSDigits("OVERWRITE");
+ return kTRUE;
}
-
//______________________________________________________________________
void AliITS::UpdateInternalGeometry(){
-
//reads new geometry from TGeo
// AliDebug(1,"Delete ITSgeom and create a new one reading TGeo");
AliITSVersion_t version = (AliITSVersion_t)IsVersion();
- Int_t minor = 0;
- if(version==kvPPRasymmFMD) minor=2; // default minor version for this geom.
AliITSInitGeometry initgeom;
- AliITSgeom* geom = initgeom.CreateAliITSgeom(version,minor);
+ AliITSgeom* geom = initgeom.CreateAliITSgeom(version);
SetITSgeom(geom);
}
+//______________________________________________________________________
+AliTriggerDetector* AliITS::CreateTriggerDetector() const {
+ // create an AliITSTrigger object (and set trigger conditions as input)
+ return new AliITSTrigger(fDetTypeSim->GetTriggerConditions());
+}
+//______________________________________________________________________
+void AliITS::WriteFOSignals(){
+// This method write FO signals in Digits tree both in Hits2Digits
+// or SDigits2Digits
+
+ fDetTypeSim->ProcessNoiseForFastOr();
+ fDetTypeSim->WriteFOSignals();
+}
+