#include "AliITSClusterFinderSSD.h"
#include "AliITSDetType.h"
#include "AliITSLoader.h"
-#include "AliITSRawCluster.h"
+#include "AliITSRawClusterSPD.h"
+#include "AliITSRawClusterSDD.h"
+#include "AliITSRawClusterSSD.h"
#include "AliITSRecPoint.h"
-#include "AliITSdigit.h"
+#include "AliITSdigitSPD.h"
+#include "AliITSdigitSDD.h"
+#include "AliITSdigitSSD.h"
#include "AliITSgeom.h"
#include "AliITShit.h"
#include "AliITSmodule.h"
#include "AliITSsimulationSDD.h"
#include "AliITSsimulationSPD.h"
#include "AliITSsimulationSSD.h"
+#include "AliMC.h"
+#include "AliITSDigitizer.h"
+#include "AliITSDDLRawData.h"
+#include "AliITSclustererV2.h"
+#include "AliITStrackerV2.h"
+#include "AliITStrackerSA.h"
+#include "AliITSpidESD.h"
+#include "AliV0vertexer.h"
+#include "AliITSVertexerPPZ.h"
+#include "AliITSVertexerFast.h"
+#include "AliITSVertexerZ.h"
+#include "AliITSVertexerIons.h"
+#include "AliCascadeVertexer.h"
+#include "AliESD.h"
+#include "AliRun.h"
ClassImp(AliITS)
//______________________________________________________________________
-AliITS::AliITS() : AliDetector() {
+AliITS::AliITS() : AliDetector(),
+ fITSgeom(0),
+ fEuclidOut(0),
+ fITSmodules(0),
+ fOpt("All"),
+ fIdN(0),
+ fIdSens(0),
+ fIdName(0),
+ fNDetTypes(kNTYPES),
+ fDetTypes(0),
+ fSDigits(0),
+ fNSDigits(0),
+ fDtype(0),
+ fNdtype(0),
+ fCtype(0),
+ fNctype(0),
+ fRecPoints(0),
+ fNRecPoints(0),
+ fSelectedVertexer(0){
// Default initializer for ITS
// The default constructor of the AliITS class. In addition to
// creating the AliITS class it zeros the variables fIshunt (a member
fIshunt = 0; // not zeroed in AliDetector.
// AliITS variables.
- fEuclidOut = 0;
- fITSgeom = 0;
- fITSmodules = 0;
- fOpt = "All";
// SetDetectors(); // default to fOpt="All". This variable not written out.
-
- fIdN = 0;
- fIdName = 0;
- fIdSens = 0;
-
- fNDetTypes = kNTYPES;
- fDetTypes = 0;
-
- fSDigits = 0;
- fNSDigits = 0;
-
- fNdtype = 0;
- fDtype = 0;
-
- fCtype = 0;
- fNctype = 0;
-
- fRecPoints = 0;
- fNRecPoints = 0;
-
SetMarkerColor(kRed);
+ SelectVertexer(" ");
}
//______________________________________________________________________
-AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
+AliITS::AliITS(const char *name, const char *title):AliDetector(name,title),
+ fITSgeom(0),
+ fEuclidOut(0),
+ fITSmodules(0),
+ fOpt("All"),
+ fIdN(0),
+ fIdSens(0),
+ fIdName(0),
+ fNDetTypes(kNTYPES),
+ fDetTypes(0),
+ fSDigits(0),
+ fNSDigits(0),
+ fDtype(0),
+ fNdtype(0),
+ fCtype(0),
+ fNctype(0),
+ fRecPoints(0),
+ fNRecPoints(0),
+ fSelectedVertexer(0){
// The standard Constructor for the ITS class. In addition to
// creating the AliITS class, it allocates memory for the TClonesArrays
// fHits, fSDigits, fDigits, fITSpoints, and the TObjArray of fCtype
fIshunt = 0; // not zeroed in AliDetector
fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector
- gAlice->AddHitList(fHits); // Not done in AliDetector.
+ if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector.
fEuclidOut = 0;
fITSgeom = 0;
} // end for i
SetMarkerColor(kRed);
-
+ SelectVertexer(" ");
}
//______________________________________________________________________
AliITS::~AliITS(){
SetDefaults();
// Array of TStrings
- for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
+ if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
}
//______________________________________________________________________
void AliITS::SetDefaults(){
}
//______________________________________________________________________
void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
- Option_t *option,Text_t *filename){
+ Option_t *option, const char *filename){
// fill the modules with the sorted by module hits; add hits from
// background if option=Add.
// Inputs:
// none.
// return; // Using Hits in place of the larger sDigits.
+ fLoader->LoadHits("read");
+ fLoader->LoadSDigits("recreate");
AliRunLoader* rl = fLoader->GetRunLoader();
- AliHeader *header=rl->GetHeader(); // Get event number from this file.
- if (header == 0x0)
- {
- rl->LoadHeader();
- header=rl->GetHeader();
- if (header == 0x0) return;
- }
+
+ 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
// AliITSgeom class, option="All", input from this file only.
- HitsToSDigits(header->GetEvent(),0,-1," ",fOpt," ");
+ rl->GetEvent(iEvent);
+ if (!fLoader->TreeS()) fLoader->MakeTree("S");
+ MakeBranch("S");
+ SetTreeAddress();
+ HitsToSDigits(iEvent,0,-1," ",fOpt," ");
+ }
+ fLoader->UnloadHits();
+ fLoader->UnloadSDigits();
}
//______________________________________________________________________
void AliITS::Hits2PreDigits(){
HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
}
//______________________________________________________________________
+AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const
+{
+ return new AliITSDigitizer(manager);
+}
+//______________________________________________________________________
void AliITS::SDigitsToDigits(Option_t *opt){
// Standard Summable digits to Digits function.
// Inputs:
iDetType = DetType(id);
sim = (AliITSsimulation*)iDetType->GetSimulationModel();
if (!sim) {
- Error("SDigit2Digits",
- "The simulation class was not instanciated!");
+ Error("SDigit2Digits","The simulation class was not "
+ "instanciated for module %d type %s!",module,
+ geom->GetModuleTypeName(module));
exit(1);
} // end if !sim
sim->InitSimulationModule(module,gAlice->GetEvNumber());
// Outputs:
// none.
- AliHeader *header=fLoader->GetRunLoader()->GetHeader(); // Get event number from this file.
+ fLoader->LoadHits("read");
+ fLoader->LoadDigits("recreate");
+ AliRunLoader* rl = fLoader->GetRunLoader();
+
+ 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
// AliITSgeom class, option="All", input from this file only.
- HitsToDigits(header->GetEvent(),0,-1," ",fOpt," ");
+ rl->GetEvent(iEvent);
+ if (!fLoader->TreeD()) fLoader->MakeTree("D");
+ MakeBranch("D");
+ SetTreeAddress();
+ HitsToDigits(iEvent,0,-1," ",fOpt," ");
+ }
+
+ fLoader->UnloadHits();
+ fLoader->UnloadDigits();
}
//______________________________________________________________________
void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
- Option_t *option, Option_t *opt,Text_t *filename){
+ Option_t *option, Option_t *opt, const char *filename){
// keep galice.root for signal and name differently the file for
// background when add! otherwise the track info for signal will be lost !
// the condition below will disappear when the geom class will be
}
//______________________________________________________________________
void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
- Option_t *option, Option_t *opt,Text_t *filename){
+ Option_t *option, Option_t *opt, const char *filename){
// Keep galice.root for signal and name differently the file for
// background when add! otherwise the track info for signal will be lost !
// the condition below will disappear when the geom class will be
iDetType = DetType(id);
sim = (AliITSsimulation*)iDetType->GetSimulationModel();
if (!sim) {
- Error("HitsToSDigits",
- "The simulation class was not instanciated!");
+ Error("HitsToSDigits","The simulation class was not "
+ "instanciated for module %d type %s!",module,
+ geom->GetModuleTypeName(module));
exit(1);
} // end if !sim
mod = (AliITSmodule *)fITSmodules->At(module);
}
//______________________________________________________________________
void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
- Option_t *option, Option_t *opt,Text_t *filename){
+ Option_t *option, Option_t *opt, const char *filename){
// Keep galice.root for signal and name differently the file for
// background when add! otherwise the track info for signal will be lost !
// the condition below will disappear when the geom class will be
iDetType = DetType(id);
sim = (AliITSsimulation*)iDetType->GetSimulationModel();
if (!sim) {
- Error("HitsToDigits",
- "The simulation class was not instanciated!");
+ Error("HitsToDigits","The simulation class was not "
+ "instanciated for module %d type %s!",module,
+ geom->GetModuleTypeName(module));
exit(1);
} // end if !sim
mod = (AliITSmodule *)fITSmodules->At(module);
//______________________________________________________________________
void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
Int_t *hits,Float_t *charges){
- // Add a simulated digit to the list.
- // Inputs:
- // Int_t id Detector type number.
- // Float_t phys Physics indicator. See AliITSdigits.h
- // Int_t *digits Integer array containing the digits info. See
- // AliITSdigit.h
- // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()]
- // containing the track numbers that contributed to
- // this digit.
- // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()]
- // containing the hit numbers, from AliITSmodule, that
- // contributed to this digit.
- // Float_t *charge Floating point array of the signals contributed
- // to this digit by each track.
- // Outputs:
- // none.
- // Return:
- // none.
+ // Add a simulated digit to the list.
+ // Inputs:
+ // Int_t id Detector type number.
+ // Float_t phys Physics indicator. See AliITSdigits.h
+ // Int_t *digits Integer array containing the digits info. See
+ // AliITSdigit.h
+ // Int_t *tracks Integer array [AliITSdigitS?D::GetNTracks()]
+ // containing the track numbers that contributed to
+ // this digit.
+ // Int_t *hits Integer array [AliITSdigitS?D::GetNTracks()]
+ // containing the hit numbers, from AliITSmodule, that
+ // contributed to this digit.
+ // Float_t *charge Floating point array of the signals contributed
+ // to this digit by each track.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
- TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
- switch(id){
- case 0:
- new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
- break;
- case 1:
- new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
- hits,charges);
- break;
- case 2:
- new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
- break;
- } // end switch id
+ TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
+ AliITSresponseSDD *resp = 0;
+ switch(id){
+ case 0:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
+ break;
+ case 1:
+ resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel();
+ new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
+ hits,charges,resp);
+ break;
+ case 2:
+ new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
+ break;
+ } // end switch id
}
+
+//______________________________________________________________________
+void AliITS::Digits2Raw()
+{
+// convert digits of the current event to raw data
+
+ fLoader->LoadDigits();
+ TTree* digits = fLoader->TreeD();
+ if (!digits) {
+ Error("Digits2Raw", "no digits tree");
+ return;
+ }
+ SetTreeAddressD(digits);
+
+ AliITSDDLRawData rawWriter;
+ //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.
+ rawWriter.SetVerbose(0);
+
+ //SILICON PIXEL DETECTOR
+ Info("Digits2Raw", "Formatting raw data for SPD");
+ rawWriter.RawDataSPD(digits->GetBranch("ITSDigitsSPD"));
+
+ //SILICON DRIFT DETECTOR
+ Info("Digits2Raw", "Formatting raw data for SDD");
+ rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"));
+
+ //SILICON STRIP DETECTOR
+ Info("Digits2Raw", "Formatting raw data for SSD");
+ rawWriter.RawDataSSD(digits->GetBranch("ITSDigitsSSD"));
+
+ fLoader->UnloadDigits();
+}
+
//______________________________________________________________________
void AliITS::MakeTreeC(Option_t *option){
// Create a separate tree to store the clusters.
}
//______________________________________________________________________
void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
- Option_t *opt0,Option_t *opt1,Text_t *flnm){
+ Option_t *opt0,Option_t *opt1, const char *flnm){
// keep galice.root for signal and name differently the file for
// background when add! otherwise the track info for signal will be lost !
// the condition below will disappear when the geom class will be
cout<<"HitsToFastRecPoints: N mod = "<<geom->GetIndexMax()<<endl;
- for(module=0;module<geom->GetIndexMax();module++)
- {
+ for(module=0;module<geom->GetIndexMax();module++){
id = geom->GetModuleType(module);
if (!all && !det[id]) continue;
iDetType = DetType(id);
sim = (AliITSsimulation*)iDetType->GetSimulationModel();
if (!sim)
{
- Error("HitsToFastPoints","The simulation class was not instanciated!");
+ Error("HitsToFastPoints","The simulation class was not "
+ "instanciated for module %d type %x!",module,
+ geom->GetModuleTypeName(module));
exit(1);
} // end if !sim
mod = (AliITSmodule *)fITSmodules->At(module);
}
+//_____________________________________________________________________________
+void AliITS::Reconstruct() const
+{
+// reconstruct clusters
+
+ AliLoader* loader = GetLoader();
+ loader->LoadRecPoints("recreate");
+ loader->LoadDigits("read");
+
+ AliITSclustererV2 clusterer(GetITSgeom());
+ AliRunLoader* runLoader = loader->GetRunLoader();
+ Int_t nEvents = runLoader->GetNumberOfEvents();
+ runLoader->LoadKinematics();
+
+ for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
+ runLoader->GetEvent(iEvent);
+
+ TTree* treeClusters = loader->TreeR();
+ if (!treeClusters) {
+ loader->MakeTree("R");
+ treeClusters = loader->TreeR();
+ }
+ TTree* treeDigits = loader->TreeD();
+ if (!treeDigits) {
+ Error("Reconstruct", "Can't get digits tree !");
+ return;
+ }
+
+ clusterer.Digits2Clusters(treeDigits, treeClusters);
+
+ loader->WriteRecPoints("OVERWRITE");
+ }
+
+ loader->UnloadRecPoints();
+ loader->UnloadDigits();
+}
+
+//_____________________________________________________________________________
+AliTracker* AliITS::CreateTracker() const
+{
+// create an ITS tracker
+
+ return new AliITStrackerSA(GetITSgeom());
+}
+//_____________________________________________________________________________
+AliVertexer* AliITS::CreateVertexer() const
+{
+ // create a ITS vertexer
+
+ if(fSelectedVertexer.Contains("ions") || fSelectedVertexer.Contains("IONS")){
+ Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
+ return new AliITSVertexerIons("null");
+ }
+ if(fSelectedVertexer.Contains("smear") || fSelectedVertexer.Contains("SMEAR")){
+ Double_t smear[3]={0.005,0.005,0.01};
+ Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
+ return new AliITSVertexerFast(smear);
+ }
+ if(fSelectedVertexer.Contains("ppz") || fSelectedVertexer.Contains("PPZ")){
+ Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
+ return new AliITSVertexerPPZ("null");
+ }
+ // by default an AliITSVertexerZ object is instatiated
+ Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
+ return new AliITSVertexerZ("null");
+}
+
+//_____________________________________________________________________________
+void AliITS::FillESD(AliESD* esd) const
+{
+// make PID, find V0s and cascades
+
+ Double_t parITS[] = {34., 0.15, 10.};
+ AliITSpidESD itsPID(parITS);
+ itsPID.MakePID(esd);
+
+ // V0 finding
+ Double_t cuts[]={33, // max. allowed chi2
+ 0.16,// min. allowed negative daughter's impact parameter
+ 0.05,// min. allowed positive daughter's impact parameter
+ 0.08,// max. allowed DCA between the daughter tracks
+ 0.99,// max. allowed cosine of V0's pointing angle
+ 0.9, // min. radius of the fiducial volume
+ 2.9 // max. radius of the fiducial volume
+ };
+ AliV0vertexer vtxer(cuts);
+ Double_t vtx[3], cvtx[6];
+ esd->GetVertex()->GetXYZ(vtx);
+ esd->GetVertex()->GetSigmaXYZ(cvtx);
+ vtxer.SetVertex(vtx);
+ vtxer.Tracks2V0vertices(esd);
+
+ // cascade finding
+ Double_t cts[]={33., // max. allowed chi2
+ 0.05, // min. allowed V0 impact parameter
+ 0.008, // window around the Lambda mass
+ 0.035, // min. allowed bachelor's impact parameter
+ 0.10, // max. allowed DCA between a V0 and a track
+ 0.9985, //max. allowed cosine of the cascade pointing angle
+ 0.9, // min. radius of the fiducial volume
+ 2.9 // max. radius of the fiducial volume
+ };
+ AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
+ cvtxer.SetVertex(vtx);
+ cvtxer.V0sTracks2CascadeVertices(esd);
+}
+