DDL module map for SDD in the OCDB (F. Prino)
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Jan 2008 10:05:59 +0000 (10:05 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 22 Jan 2008 10:05:59 +0000 (10:05 +0000)
35 files changed:
ITS/AliITS.cxx
ITS/AliITSClusterFinderV2SDD.cxx
ITS/AliITSDDLModuleMapSDD.cxx [new file with mode: 0644]
ITS/AliITSDDLModuleMapSDD.h [new file with mode: 0644]
ITS/AliITSDDLRawData.cxx
ITS/AliITSDDLRawData.h
ITS/AliITSDetTypeRec.cxx
ITS/AliITSDetTypeRec.h
ITS/AliITSDetTypeSim.cxx
ITS/AliITSDetTypeSim.h
ITS/AliITSOnlineSDD.cxx
ITS/AliITSOnlineSDD.h
ITS/AliITSOnlineSDDBTP.cxx [deleted file]
ITS/AliITSOnlineSDDBTP.h [deleted file]
ITS/AliITSOnlineSDDBase.cxx
ITS/AliITSOnlineSDDBase.h
ITS/AliITSOnlineSDDCMN.cxx
ITS/AliITSOnlineSDDCMN.h
ITS/AliITSOnlineSDDInjectors.cxx
ITS/AliITSOnlineSDDInjectors.h
ITS/AliITSOnlineSDDTP.cxx
ITS/AliITSOnlineSDDTP.h
ITS/AliITSPreprocessorSDD.cxx
ITS/AliITSPreprocessorSDD.h
ITS/AliITSRawStreamSDD.cxx
ITS/AliITSRawStreamSDD.h
ITS/Calib/DDLMapSDD/Run0_9999999_v0_s0.root [new file with mode: 0644]
ITS/ITSSDDBASda.cxx
ITS/ITSSDDGAINda.cxx
ITS/ITSSDDINJda.cxx
ITS/ITSbaseLinkDef.h
ITS/ITSrecLinkDef.h
ITS/StoreDDLMapSDD.C [new file with mode: 0644]
ITS/libITSbase.pkg
ITS/libITSrec.pkg

index 167bde7..114680b 100644 (file)
@@ -1096,6 +1096,7 @@ void AliITS::Digits2Raw(){
       return;
   }
   fDetTypeSim->SetTreeAddressD(digits,(Char_t*)GetName());
+  AliITSDDLModuleMapSDD* ddlsdd=fDetTypeSim->GetDDLModuleMapSDD();
 
   AliITSDDLRawData rawWriter;
   //Verbose level
@@ -1114,7 +1115,7 @@ void AliITS::Digits2Raw(){
     
   //SILICON DRIFT DETECTOR
   Info("Digits2Raw", "Formatting raw data for SDD");
-  rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"));
+  rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"),ddlsdd);
     
   //SILICON STRIP DETECTOR
   Info("Digits2Raw", "Formatting raw data for SSD");
@@ -1199,6 +1200,8 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
     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;
index 1f57718..539c283 100644 (file)
@@ -253,6 +253,13 @@ void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader,TClones
   //------------------------------------------------------------
   rawReader->Reset();
   AliITSRawStreamSDD inputSDD(rawReader);
+  AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(240);
+  /*
+  printf("gain anode 10=%f\n",cal->GetDriftSpeedAtAnode(10));
+  printf("drift speed anode 10=%f\n",cal->GetChannelGain(10));
+  */
+  AliITSDDLModuleMapSDD *ddlmap=(AliITSDDLModuleMapSDD*)fDetTypeRec->GetDDLModuleMapSDD();
+  inputSDD.SetDDLModuleMap(ddlmap);
   FindClustersSDD(&inputSDD,clusters);
 
 }
diff --git a/ITS/AliITSDDLModuleMapSDD.cxx b/ITS/AliITSDDLModuleMapSDD.cxx
new file mode 100644 (file)
index 0000000..d1e709c
--- /dev/null
@@ -0,0 +1,191 @@
+/**************************************************************************
+ * Copyright(c) 2007-2009, 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: $ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Implementation of the class for SDD DDL mapping in the OCDB   //
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+#include "AliITSDDLModuleMapSDD.h"
+
+ClassImp(AliITSDDLModuleMapSDD)
+
+
+//______________________________________________________________________
+AliITSDDLModuleMapSDD::AliITSDDLModuleMapSDD():TObject(){
+  // default constructor
+  SetDefaultMap();
+}
+//______________________________________________________________________
+AliITSDDLModuleMapSDD::AliITSDDLModuleMapSDD(Char_t *ddlmapfile):TObject(){
+  // constructor used to read DDL map  from text file
+  ReadDDLModuleMap(ddlmapfile);
+}
+//______________________________________________________________________
+void AliITSDDLModuleMapSDD::SetDefaultMap(){
+  // Fill DDL map according to the default connection scheme
+  Int_t defaultmap[kDDLsNumber][kModulesPerDDL] = 
+    {
+      {240,241,242,246,247,248,252,253,254,258,259,260},
+      {264,265,266,270,271,272,276,277,278,282,283,284},
+      {288,289,290,294,295,296,300,301,302,306,307,308},
+      {312,313,314,318,319,320,-1,-1,-1,-1,-1,-1},
+      {243,244,245,249,250,251,255,256,257,261,262,263},
+      {267,268,269,273,274,275,279,280,281,285,286,287},
+      {291,292,293,297,298,299,303,304,305,309,310,311},
+      {315,316,317,321,322,323,-1,-1,-1,-1,-1,-1},
+      {324,325,326,327,332,333,334,335,340,341,342,343},
+      {348,349,350,351,356,357,358,359,364,365,366,367},
+      {372,373,374,375,380,381,382,383,388,389,390,391},
+      {396,397,398,399,404,405,406,407,412,413,414,415},
+      {420,421,422,423,428,429,430,431,436,437,438,439},
+      {444,445,446,447,452,453,454,455,460,461,462,463},
+      {468,469,470,471,476,477,478,479,484,485,486,487},
+      {492,493,494,495,-1,-1,-1,-1,-1,-1,-1,-1},
+      {328,329,330,331,336,337,338,339,344,345,346,347},
+      {352,353,354,355,360,361,362,363,368,369,370,371},
+      {376,377,378,379,384,385,386,387,392,393,394,395},
+      {400,401,402,403,408,409,410,411,416,417,418,419},
+      {424,425,426,427,432,433,434,435,440,441,442,443},
+      {448,449,450,451,456,457,458,459,464,465,466,467},
+      {472,473,474,475,480,481,482,483,488,489,490,491},
+      {496,497,498,499,-1,-1,-1,-1,-1,-1,-1,-1}
+    };
+
+  for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
+    for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
+      fDDLModuleMap[iddl][ichan]=defaultmap[iddl][ichan];
+    }
+  }
+}
+
+//______________________________________________________________________
+void AliITSDDLModuleMapSDD::SetDec07part1Map(){
+  // Fill DDL map according to dec07 cosmic run connections (run<14435)
+  Int_t dec07part1map[kDDLsNumber][kModulesPerDDL] = 
+    {
+      {328,329,330,331,336,337,338,339,344,345,346,347}, //Crate TOP
+      {352,353,354,355,-1,-1,-1,-1,-1,-1,-1,-1},
+      {376,377,378,379,384,385,386,387,408,409,410,411},
+      {400,401,402,403,392,393,394,395,416,417,418,419},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+    
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate MED
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {368,369,370,371,360,361,362,363,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+    
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate BOT
+      {240,241,242,246,247,248,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,264,265,266,270,271,272},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {267,268,269,273,274,275,-1,-1,-1,-1,-1,-1},
+      {243,244,245,249,250,251,255,256,257,261,262,263}
+    };
+  for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
+    for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
+      fDDLModuleMap[iddl][ichan]=dec07part1map[iddl][ichan];
+    }
+  }
+}
+
+
+//______________________________________________________________________
+void AliITSDDLModuleMapSDD::SetDec07part2Map(){
+  // Fill DDL map according to dec07 cosmic run connection (run>14435)
+  Int_t dec07part2map[kDDLsNumber][kModulesPerDDL] = 
+    {
+      {328,329,330,331,336,337,338,339,344,345,346,347}, //Crate TOP
+      {352,353,354,355,360,361,362,363,368,369,370,371},
+      {376,377,378,379,384,385,386,387,408,409,410,411},
+      {400,401,402,403,392,393,394,395,416,417,418,419},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate MED
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},   //Crate BOT
+      {240,241,242,246,247,248,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,264,265,266,270,271,272},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+      {267,268,269,273,274,275,-1,-1,-1,-1,-1,-1},
+      {243,244,245,249,250,251,255,256,257,261,262,263}
+    };
+  for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
+    for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
+      fDDLModuleMap[iddl][ichan]=dec07part2map[iddl][ichan];
+    }
+  }
+}
+
+//______________________________________________________________________
+void AliITSDDLModuleMapSDD::SetDDLMap(AliITSDDLModuleMapSDD* ddlmap){
+// Fill DDL map
+  for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
+    for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
+      fDDLModuleMap[iddl][ichan]=ddlmap->GetModuleNumber(iddl,ichan);
+    }
+  }
+}
+//______________________________________________________________________
+void AliITSDDLModuleMapSDD::ReadDDLModuleMap(Char_t *ddlmapfile){
+  // Fill DDL map from ASCCI data file
+  FILE *fil;
+  fil=fopen(ddlmapfile,"r");  
+  Int_t mod;
+  for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
+    for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
+      fscanf(fil,"%d",&mod);
+      fDDLModuleMap[iddl][ichan]=mod;
+    }
+  }
+  fclose(fil);
+}
+
+//______________________________________________________________________
+void AliITSDDLModuleMapSDD::PrintDDLMap() const {
+  // printout DDL map
+  for(Int_t iddl=0;iddl<kDDLsNumber;iddl++){
+    for(Int_t ichan=0; ichan<kModulesPerDDL; ichan++){
+      printf("%d  ",fDDLModuleMap[iddl][ichan]);
+    }
+    printf("\n");
+  }
+}
diff --git a/ITS/AliITSDDLModuleMapSDD.h b/ITS/AliITSDDLModuleMapSDD.h
new file mode 100644 (file)
index 0000000..b2dd2f5
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef ALIITSDDLMODULEMAPSDD_H
+#define ALIITSDDLMODULEMAPSDD_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id:  $ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Class to store SDD DDL mapping in the OCDB                    //
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+#include<TObject.h>
+
+
+class AliITSDDLModuleMapSDD : public TObject {
+
+ public:
+
+  AliITSDDLModuleMapSDD();
+  AliITSDDLModuleMapSDD(Char_t *ddlmapfile);
+  virtual ~AliITSDDLModuleMapSDD(){};
+
+  void SetDefaultMap();
+  void SetDec07part1Map();
+  void SetDec07part2Map();
+  void SetDDLMapElement(Int_t iDDL, Int_t iChan, Int_t iMod){fDDLModuleMap[iDDL][iChan]=iMod;}
+  void SetDDLMap(AliITSDDLModuleMapSDD* ddlmap);
+  void ReadDDLModuleMap(Char_t *ddlmapfile);
+
+  Int_t GetModuleNumber(UInt_t iDDL, UInt_t iChan) const {return fDDLModuleMap[iDDL][iChan];}
+
+  void PrintDDLMap() const ;
+
+ protected:
+  
+  enum {kDDLsNumber = 24};      // number of DDLs in SDD
+  enum {kModulesPerDDL = 12};   // number of modules in each DDL 
+
+  Int_t fDDLModuleMap[kDDLsNumber][kModulesPerDDL]; //  mapping DDL/module -> module number
+
+  ClassDef(AliITSDDLModuleMapSDD,1);
+};
+#endif
index ca7800d..7a04db2 100644 (file)
@@ -31,6 +31,7 @@
 #include "AliRawDataHeaderSim.h"
 #include "AliITSRawStreamSPD.h"
 #include "AliITSRawStreamSDD.h"
+#include "AliITSDDLModuleMapSDD.h"
 #include "AliITSRawStreamSSD.h"
 #include "AliITSIntMap.h"
 #include "AliBitPacking.h"
@@ -578,7 +579,7 @@ Int_t AliITSDDLRawData::RawDataSSD(TBranch* branch){
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch){
+Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch, AliITSDDLModuleMapSDD* ddlsdd){
     //This method creates the Raw data files for SDD detectors
   const Int_t kSize=131072; //256*512
   UInt_t buf[kSize];      
@@ -609,7 +610,7 @@ Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch){
 
     //Loops over Modules of a particular DDL
     for (Int_t mod=0; mod<AliITSRawStreamSDD::kModulesPerDDL; mod++){
-      Int_t moduleNumber = AliITSRawStreamSDD::GetModuleNumber(i, mod);
+      Int_t moduleNumber = ddlsdd->GetModuleNumber(i, mod);
       if(moduleNumber!=-1){
        digits->Clear();
        branch->GetEvent(moduleNumber);
index 3696ef8..657d557 100644 (file)
@@ -1,14 +1,18 @@
 /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-///////////////////////////////////////////////////////////////////////////////////////////
-// Class used for generating the files containing raw data, required for  Data Challenge //
-///////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Class used for generating the files containing raw data,                //
+// required for  Data Challenge                                            //
+/////////////////////////////////////////////////////////////////////////////
+
+/* $Id$ */
 
 #ifndef AliITSDDLRAWDATA_H
 #define AliITSDDLRAWDATA_H
 
 class TTree;
+class AliITSDDLModuleMapSDD;
 
 class AliITSDDLRawData:public TObject{
  public:
@@ -18,7 +22,7 @@ class AliITSDDLRawData:public TObject{
   AliITSDDLRawData& operator=(const AliITSDDLRawData &source); // ass. op.
   Int_t RawDataSPD(TBranch* branch);
   // This method generates the files with the Silicon pixel detector data
-  Int_t RawDataSDD(TBranch* branch); 
+  Int_t RawDataSDD(TBranch* branch, AliITSDDLModuleMapSDD* ddlsdd); 
   // This method generates the files with the Silicon drift detector data
   Int_t RawDataSSD(TBranch* branch);
   // This method generates the files with the Silicon pixel detector data
index 019ae4a..4e8e90e 100644 (file)
@@ -73,6 +73,7 @@ fCalibration(0),
 fPreProcess(0),
 fPostProcess(0),
 fDigits(0),
+fDDLMapSDD(0),
 fNdtype(0),
 fCtype(0),
 fNctype(0),
@@ -95,6 +96,7 @@ fFirstcall(kTRUE){
     fDigClassName[i]=0;
     fRecPointClassName[i]=0;
   }
+  fDDLMapSDD=new AliITSDDLModuleMapSDD();
   fNdtype = new Int_t[fgkNdettypes];
   fCtype = new TObjArray(fgkNdettypes);
   fNctype = new Int_t[fgkNdettypes];
@@ -123,6 +125,7 @@ fCalibration(rec.fCalibration),
 fPreProcess(rec.fPreProcess),
 fPostProcess(rec.fPostProcess),
 fDigits(rec.fDigits),
+fDDLMapSDD(rec.fDDLMapSDD),
 fNdtype(rec.fNdtype),
 fCtype(rec.fCtype),
 fNctype(rec.fNctype),
@@ -173,7 +176,7 @@ AliITSDetTypeRec::~AliITSDetTypeRec(){
   }
   if(fPreProcess) delete fPreProcess;
   if(fPostProcess) delete fPostProcess;
-
+  if(fDDLMapSDD) delete fDDLMapSDD;
   if(fDigits){
     fDigits->Delete();
     delete fDigits;
@@ -402,11 +405,12 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
   AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD");
   AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD");
   AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD");
+  AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD");
   AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD");
   AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD");
 
   if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD || 
-     !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !mapASDD || !mapTSDD){
+     !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !ddlMapSDD || !mapASDD || !mapTSDD){
     AliFatal("Calibration object retrieval failed! ");
     return kFALSE;
   }    
@@ -431,6 +435,10 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
   if(!cacheStatus)drSpSDD->SetObject(NULL);
   drSpSDD->SetOwner(kTRUE);
 
+  AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
+  if(!cacheStatus)ddlMapSDD->SetObject(NULL);
+  ddlMapSDD->SetOwner(kTRUE);
+
   TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
   if(!cacheStatus)mapASDD->SetObject(NULL);
   mapASDD->SetOwner(kTRUE);
@@ -468,9 +476,10 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
     delete mapASDD;
     delete mapTSDD;
     delete drSpSDD;
+    delete ddlMapSDD;
   }
 
-  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp)
+  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp) || (!ddlsdd)
       || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) {
     AliWarning("Can not get calibration from calibration database !");
     return kFALSE;
@@ -504,6 +513,7 @@ Bool_t AliITSDetTypeRec::GetCalibration() {
     cal->SetMapA(1,ma1);
     cal->SetMapT(0,mt0);
     cal->SetMapT(1,mt1);
+    fDDLMapSDD->SetDDLMap(ddlsdd);
     Int_t iMod = i + fNMod[0];
     SetCalibrationModel(iMod, cal);
   }
index 466efd1..1e1bb62 100644 (file)
@@ -14,6 +14,8 @@ $Id$
 #include <TObject.h>
 #include <TObjArray.h>
 #include <TClonesArray.h>
+#include "AliITSDDLModuleMapSDD.h"
+#include "AliITSgeom.h"
 
 class TTree;
 class TBranch;
@@ -27,7 +29,6 @@ class AliITSClusterFinder;
 class AliITSRawCluster;
 class AliITSRecPoint;
 class AliRawReader;
-class AliITSgeom;
 
 
 class AliITSDetTypeRec : public TObject {
@@ -51,6 +52,7 @@ class AliITSDetTypeRec : public TObject {
     virtual AliITSsegmentation* GetSegmentationModel(Int_t dettype);
     virtual AliITSCalibration* GetCalibrationModel(Int_t iMod);
     virtual AliITSClusterFinder* GetReconstructionModel(Int_t dettype);
+    virtual AliITSDDLModuleMapSDD* GetDDLModuleMapSDD() const { return fDDLMapSDD;}
 
     virtual void SetDigitClassName(Int_t i,Char_t *digit) 
       {fDigClassName[i]=digit;}
@@ -109,6 +111,7 @@ class AliITSDetTypeRec : public TObject {
     TObjArray    *fPreProcess;    //! [] e.g. Find Calibration values
     TObjArray    *fPostProcess;   //! [] e.g. find primary vertex
     TObjArray    *fDigits;        //! [NMod][NDigits]
+    AliITSDDLModuleMapSDD *fDDLMapSDD; //! mapping DDL/module -> SDD module number
     Int_t        *fNdtype;        //! detector types  
     Char_t*       fClusterClassName[3]; //! String with Cluster class name
     Char_t*       fDigClassName[3];     //! String with digit class name.
@@ -123,7 +126,7 @@ class AliITSDetTypeRec : public TObject {
     TString fSelectedVertexer; // Vertexer selected in CreateVertexer
     Bool_t fFirstcall;         //! flag
 
-    ClassDef(AliITSDetTypeRec,7) // ITS Reconstruction structure
+    ClassDef(AliITSDetTypeRec,8) // ITS Reconstruction structure
 };
 
 #endif
index f056e12..0654715 100644 (file)
@@ -80,6 +80,7 @@ fSDigits(),      //! [NMod][NSDigits]
 fNDigits(0),     //! number of Digits
 fRunNumber(0),   //! Run number (to access DB)
 fDigits(),       //! [NMod][NDigits]
+fDDLMapSDD(0),
 fHitClassName(), // String with Hit class name.
 fSDigClassName(),// String with SDigit class name.
 fDigClassName(), // String with digit class name.
@@ -99,6 +100,7 @@ fFirstcall(kTRUE){ // flag
   fSDigits = new TClonesArray("AliITSpListItem",1000);
   fDigits = new TObjArray(fgkNdettypes);
   fNDigits = new Int_t[fgkNdettypes];
+  fDDLMapSDD=new AliITSDDLModuleMapSDD();
   fNMod[0] = fgkDefaultNModulesSPD;
   fNMod[1] = fgkDefaultNModulesSDD;
   fNMod[2] = fgkDefaultNModulesSSD;
@@ -148,6 +150,7 @@ AliITSDetTypeSim::~AliITSDetTypeSim(){
        delete fPostProcess;
     }
     fPostProcess = 0;
+    if(fDDLMapSDD) delete fDDLMapSDD;
     if(fNDigits) delete [] fNDigits;
     fNDigits = 0;
     if (fLoader)fLoader->GetModulesFolder()->Remove(this);
@@ -175,6 +178,7 @@ fSDigits(source.fSDigits),      //! [NMod][NSDigits]
 fNDigits(source.fNDigits),     //! number of Digits
 fRunNumber(source.fRunNumber),   //! Run number (to access DB)
 fDigits(source.fDigits),       //! [NMod][NDigits]
+fDDLMapSDD(source.fDDLMapSDD),
 fHitClassName(source.fHitClassName), // String with Hit class name.
 fSDigClassName(source.fSDigClassName),// String with SDigit class name.
 fDigClassName(), // String with digit class name.
@@ -452,6 +456,7 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
   AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/SPDDead", run);
   AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
   AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD",run);
+  AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD",run);
   AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD",run);
   AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD",run);
   // AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
@@ -464,7 +469,7 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
   AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run);
 
   if(!entrySPD || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD || 
-     !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !mapASDD ||!mapTSDD){
+     !entry2SPD || !entry2SDD || !entry2SSD || !drSpSDD || !ddlMapSDD || !mapASDD ||!mapTSDD){
     AliFatal("Calibration object retrieval failed! ");
     return kFALSE;
   }    
@@ -495,6 +500,10 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
   if(!isCacheActive)drSpSDD->SetObject(NULL);
   drSpSDD->SetOwner(kTRUE);
 
+  AliITSDDLModuleMapSDD *ddlsdd=(AliITSDDLModuleMapSDD*)ddlMapSDD->GetObject();
+  if(!isCacheActive)ddlMapSDD->SetObject(NULL);
+  ddlMapSDD->SetOwner(kTRUE);
+
   TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
   if(!isCacheActive)mapASDD->SetObject(NULL);
   mapASDD->SetOwner(kTRUE);
@@ -538,11 +547,12 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
     delete mapASDD;   
     delete mapTSDD;
     delete drSpSDD;
+    delete ddlMapSDD;
   }
   
   AliCDBManager::Instance()->SetCacheFlag(origCacheStatus);
 
-  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp)
+  if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!drSp) || (!ddlsdd)
       || (!mapAn) || (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badchannelsSSD)) {
     AliWarning("Can not get calibration from calibration database !");
     return kFALSE;
@@ -576,6 +586,7 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
     cal->SetMapA(1,ma1);
     cal->SetMapT(0,mt0);
     cal->SetMapT(1,mt1);
+    fDDLMapSDD->SetDDLMap(ddlsdd);
     Int_t iMod = i + fNMod[0];
     SetCalibrationModel(iMod, cal);
  }
index daa05c6..3dccd4a 100644 (file)
@@ -16,6 +16,7 @@ $Id$
 #include <TObjArray.h>
 #include <TClonesArray.h>
 #include "AliITSCalibration.h"
+#include "AliITSDDLModuleMapSDD.h"
 #include "AliITSLoader.h"
 #include "AliITSgeom.h"
 
@@ -53,6 +54,7 @@ class AliITSDetTypeSim : public TObject {
     virtual AliITSresponse* GetResponse(Int_t dettype) {
        return GetCalibrationModel(
            GetITSgeom()->GetStartDet(dettype))->GetResponse();}
+    virtual AliITSDDLModuleMapSDD* GetDDLModuleMapSDD()const { return fDDLMapSDD;}
     TObjArray* GetCalibrationArray() const {return fCalibration;}
     TObjArray* GetSegmentation() const {return fSegmentation;}
     void ResetCalibrationArray();
@@ -112,13 +114,14 @@ class AliITSDetTypeSim : public TObject {
     Int_t*        fNDigits;      //! [NDet] number of Digits for det.
     Int_t         fRunNumber;    //! run number (to access DB)
     TObjArray     *fDigits;      //! [NMod][NDigits]
+    AliITSDDLModuleMapSDD *fDDLMapSDD; //! mapping DDL/module -> SDD module number
     TString       fHitClassName; //! String with Hit class name
     TString       fSDigClassName;//! String with SDigit class name.
     Char_t*       fDigClassName[3]; //! String with digit class name.
     AliITSLoader* fLoader;          //! loader  
     Bool_t        fFirstcall;       //! flag
     
-    ClassDef(AliITSDetTypeSim,5) // ITS Simulation structure
+    ClassDef(AliITSDetTypeSim,6) // ITS Simulation structure
  
 };
 
index 796efea..a207555 100644 (file)
 
 ClassImp(AliITSOnlineSDD)
 //______________________________________________________________________
-  AliITSOnlineSDD::AliITSOnlineSDD():TObject(),fModuleId(0),fSide(0),fFirstGoodTB(0),fLastGoodTB(0)
+  AliITSOnlineSDD::AliITSOnlineSDD():TObject(),fDDL(0),fCarlos(0),fSide(0),fFirstGoodTB(0),fLastGoodTB(0)
 {
   // default constructor
   SetFirstGoodTB();
   SetLastGoodTB();
 }
 //______________________________________________________________________
-  AliITSOnlineSDD::AliITSOnlineSDD(Int_t mod, Int_t sid):TObject(),fModuleId(0),fSide(0),fFirstGoodTB(0),fLastGoodTB(0)
+  AliITSOnlineSDD::AliITSOnlineSDD(Int_t nddl, Int_t ncarlos, Int_t sid):TObject(),fDDL(0),fCarlos(0),fSide(0),fFirstGoodTB(0),fLastGoodTB(0)
 {
   // standard constructor
-  SetModule(mod);
+  SetDDL(nddl);
+  SetCarlos(ncarlos);
   SetDetectorSide(sid);
   SetFirstGoodTB();
   SetLastGoodTB();
index d4c7049..6520a0c 100644 (file)
@@ -15,26 +15,29 @@ class AliITSOnlineSDD : public TObject {
 
  public:
   AliITSOnlineSDD();
-  AliITSOnlineSDD(Int_t mod, Int_t sid);
+  AliITSOnlineSDD(Int_t nddl, Int_t ncarlos, Int_t sid);
   virtual ~AliITSOnlineSDD(){};
 
-  void SetModule(Int_t mod){fModuleId=mod;}
+  void SetDDL(Int_t nd){fDDL=nd;}
+  void SetCarlos(Int_t nc){fCarlos=nc;}
   void SetDetectorSide(Int_t sid){fSide=sid;}
   void SetFirstGoodTB(Int_t itb=1){fFirstGoodTB=itb;}
   void SetLastGoodTB(Int_t itb=254){fLastGoodTB=itb;}
 
-  Int_t GetModuleId() const {return fModuleId;}
+  Int_t GetDDL() const {return fDDL;}
+  Int_t GetCarlos() const {return fCarlos;}
   Int_t GetDetectorSide() const {return fSide;}
   Int_t GetFirstGoodTB() const {return fFirstGoodTB;}
   Int_t GetLastGoodTB() const {return fLastGoodTB;}
 
  protected:
   static const Int_t fgkNAnodes = 256; // number of anodes in each half-module
-  Int_t fModuleId;    // module number from 0 to 255
+  Int_t fDDL;         // SDD DDL number (from 0 to 24)
+  Int_t fCarlos;      // carlos number inside DDL (from 0 to 11)
   Int_t fSide;        // detector side (0-1)
   Int_t fFirstGoodTB; // first good time bin (to exclude time bin 0)
   Int_t fLastGoodTB;  // last good time bin (to exclude time bin 255)
 
-  ClassDef(AliITSOnlineSDD,2);
+  ClassDef(AliITSOnlineSDD,3);
 };
 #endif
diff --git a/ITS/AliITSOnlineSDDBTP.cxx b/ITS/AliITSOnlineSDDBTP.cxx
deleted file mode 100644 (file)
index b4966b8..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-/**************************************************************************
- * Copyright(c) 2007-2009, 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.                  *
- **************************************************************************/
-#include "AliITSOnlineSDDBTP.h"
-#include <TH2F.h>
-#include <TMath.h>
-
-
-///////////////////////////////////////////////////////////////////
-//                                                               //
-// Class used for SDD baseline, noise and gain analysis          //
-// Origin: F.Prino, Torino, prino@to.infn.it                     //
-//                                                               //
-///////////////////////////////////////////////////////////////////
-
-
-ClassImp(AliITSOnlineSDDBTP)
-//______________________________________________________________________
-  AliITSOnlineSDDBTP::AliITSOnlineSDDBTP():AliITSOnlineSDD(),fNBaseEvents(0),fNTPEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.),fNSigmaGain(0.)
-{
-  // default constructor
-  Reset();
-  SetMinBaseline();
-  SetMaxBaseline();
-  SetMinRawNoise();
-  SetMaxRawNoise();
-  SetNSigmaNoise();
-  SetNSigmaGain();
-}
-//______________________________________________________________________
-  AliITSOnlineSDDBTP::AliITSOnlineSDDBTP(Int_t mod, Int_t sid):AliITSOnlineSDD(mod,sid),fNBaseEvents(0),fNTPEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.),fNSigmaGain(0.)
-{
-  // default constructor
-  Reset();
-  SetMinBaseline();
-  SetMaxBaseline();
-  SetMinRawNoise();
-  SetMaxRawNoise();
-  SetNSigmaNoise();
-  SetNSigmaGain();
-}
-//______________________________________________________________________
-AliITSOnlineSDDBTP::~AliITSOnlineSDDBTP(){
-  // Destructor
-}
-//______________________________________________________________________
-void AliITSOnlineSDDBTP::Reset(){
-  //
-  fNBaseEvents=0;
-  fNTPEvents=0;
-  for(Int_t i=0;i<fgkNAnodes;i++){
-    fGoodAnode[i]=1;
-    fSumBaseline[i]=0.;
-    fSumRawNoise[i]=0.;
-    fSumCMN[i]=0.;
-    fSumTPPeak[i]=0.;
-    fTPPos[i]=0.;
-  }
-}
-//______________________________________________________________________
-void  AliITSOnlineSDDBTP::ValidateAnodes(){
-  //
-  for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    fGoodAnode[ian]=1;
-    if(GetAnodeBaseline(ian)>fMaxBaseline || GetAnodeBaseline(ian)<fMinBaseline) fGoodAnode[ian]=0;
-    if(GetAnodeRawNoise(ian)>fMaxRawNoise || GetAnodeRawNoise(ian)<fMinRawNoise) fGoodAnode[ian]=0;
-    if(GetAnodeRawNoise(ian)>fNSigmaNoise*CalcMeanRawNoise()) fGoodAnode[ian]=0;
-  }
-  if(fNTPEvents>0){
-    Float_t meang,rmsg;
-    StatGain(meang,rmsg);
-    Float_t lowlim=meang-fNSigmaGain*rmsg;
-    Float_t hilim=meang+fNSigmaGain*rmsg;
-    for(Int_t ian=0;ian<fgkNAnodes;ian++){
-      if(!fGoodAnode[ian]) continue;
-      if(GetChannelGain(ian)<lowlim||GetChannelGain(ian)>hilim) fGoodAnode[ian]=0;
-    }
-  }
-}
-
-//______________________________________________________________________
-void AliITSOnlineSDDBTP::AddTPEvent(TH2F* hrawd, Float_t xDAC){
-  // 
-  if(fNBaseEvents==0) return;
-  fNTPEvents++;
-  Float_t tbmax=(Float_t)hrawd->GetNbinsX();
-  for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    Float_t auxmax=0.;
-    Int_t auxtb=0;
-    if(!fGoodAnode[ian]) continue;
-    for(Int_t itb=0;itb<tbmax;itb++){
-      Float_t cnt=hrawd->GetBinContent(itb+1,ian+1);
-      if(cnt>auxmax){ 
-       auxmax=cnt;
-       auxtb=itb;
-      }
-    }
-    fSumTPPeak[ian]+=(auxmax-GetAnodeBaseline(ian))/xDAC;
-    fTPPos[ian]+=auxtb;
-  }
-}
-//______________________________________________________________________
-void AliITSOnlineSDDBTP::AddBaseEvent(TH2F* hrawd){
-  // 
-  fNBaseEvents++;
-  Float_t tbmax=(Float_t)hrawd->GetNbinsX();
-  Float_t sum[fgkNAnodes];
-  for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    Float_t sumQ=0.;
-    sum[ian]=0.;
-    for(Int_t itb=0;itb<tbmax;itb++){
-      sum[ian]+=hrawd->GetBinContent(itb+1,ian+1);
-      sumQ+=TMath::Power(hrawd->GetBinContent(itb+1,ian+1),2);      
-    }
-    sum[ian]/=tbmax;
-    sumQ/=tbmax;
-    fSumBaseline[ian]+=sum[ian];
-    fSumRawNoise[ian]+=sumQ;
-    if(fNBaseEvents==1) ValidateAnodes();
-  }
-
-
-  const Int_t kTbmax=int(tbmax);
-  Float_t *cmnEven = new Float_t[kTbmax];
-  Float_t *cmnOdd  = new Float_t[kTbmax];
-  for(Int_t itb=0;itb<tbmax;itb++){
-    Float_t sumEven=0., sumOdd=0.;
-    Int_t countEven=0,countOdd=0;
-    for(Int_t ian=0;ian<fgkNAnodes;ian+=2){
-      if(!fGoodAnode[ian]) continue;
-      sumEven+=hrawd->GetBinContent(itb+1,ian+1)-sum[ian];
-      countEven++;
-    }
-    for(Int_t ian=1;ian<fgkNAnodes;ian+=2){
-      if(!fGoodAnode[ian]) continue;
-      sumOdd+=hrawd->GetBinContent(itb+1,ian+1)-sum[ian];
-      countOdd++;
-    }
-    cmnEven[itb]=sumEven/countEven;
-    cmnOdd[itb]=sumOdd/countOdd;
-  }
-  for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    Float_t num=0.,den=0.;
-    if(!fGoodAnode[ian]) continue;
-    for(Int_t itb=0;itb<tbmax;itb++){
-      Float_t cmnCoef=cmnOdd[itb];
-      if(ian%2==0) cmnCoef=cmnEven[itb];
-      num+=(hrawd->GetBinContent(itb+1,ian+1)-sum[ian])*cmnCoef;
-      den+=TMath::Power(cmnCoef,2);
-    }
-    if(den!=0) fSumCMN[ian]+=num/den;
-  }
-  delete [] cmnEven;
-  delete [] cmnOdd;
-}
-//______________________________________________________________________
-Float_t AliITSOnlineSDDBTP::CalcMeanRawNoise() const{
-  //
-  Float_t meanns=0.;
-  Int_t cnt=0;
-  for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    if(!fGoodAnode[ian]) continue;  
-    meanns+=GetAnodeRawNoise(ian);
-    cnt++;
-  }
-  if(cnt>0) meanns/=(Float_t)cnt;
-  return meanns;
-}
-//______________________________________________________________________
-void AliITSOnlineSDDBTP::StatGain(Float_t &mean, Float_t  &rms){
-  //
-  Float_t sum=0.,sumq=0.;
-  Int_t cnt=0;
-  for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    if(!fGoodAnode[ian]) continue;
-    sum+=GetChannelGain(ian);
-    sumq+=TMath::Power(GetChannelGain(ian),2);
-    cnt++;
-  }
-  if(cnt>0){ 
-    mean=sum/(Float_t)cnt;
-    rms=TMath::Sqrt(sumq/(Float_t)cnt-mean*mean);
-  }else{ 
-    mean=0.;
-    rms=0.;
-  }
-  return;
-}
-//______________________________________________________________________
-void AliITSOnlineSDDBTP::WriteToASCII(){
-  //
-  Char_t outfilnam[100];
-  sprintf(outfilnam,"SDDbase_mod%03d_sid%d.data",fModuleId,fSide);
-  FILE* outf=fopen(outfilnam,"w");
-  Float_t corrnoise=2.;
-  for(Int_t ian=0;ian<fgkNAnodes;ian++){
-    fprintf(outf,"%d %d %8.3f %8.3f %8.3f %8.3f %8.3f\n",ian,IsAnodeGood(ian),GetAnodeBaseline(ian),GetAnodeRawNoise(ian),GetAnodeCommonMode(ian),corrnoise,GetChannelGain(ian));
-  }
-  fclose(outf);  
-}
diff --git a/ITS/AliITSOnlineSDDBTP.h b/ITS/AliITSOnlineSDDBTP.h
deleted file mode 100644 (file)
index 1ed705f..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef ALIITSONLINESDDBTP_H
-#define ALIITSONLINESDDBTP_H
-
-///////////////////////////////////////////////////////////////////
-//                                                               //
-// Class used for SDD baseline, noise and gain analysis          //
-// Origin: F.Prino, Torino, prino@to.infn.it                     //
-//                                                               //
-///////////////////////////////////////////////////////////////////
-#include "AliITSOnlineSDD.h"
-#include "TMath.h"
-
-class TH2F;
-class TGraph;
-class AliITSOnlineSDDBTP : public AliITSOnlineSDD {
-
- public:
-  AliITSOnlineSDDBTP();
-  AliITSOnlineSDDBTP(Int_t mod, Int_t sid);
-  virtual ~AliITSOnlineSDDBTP();
-  void Reset();
-  void AddBaseEvent(TH2F* hrawd);
-  void AddTPEvent(TH2F* hrawd, Float_t xDAC);
-  void ValidateAnodes();
-  void SetMinBaseline(Float_t bas=10.){fMinBaseline=bas;}
-  void SetMaxBaseline(Float_t bas=150.){fMaxBaseline=bas;}
-  void SetMinRawNoise(Float_t ns=0.001){fMinRawNoise=ns;}
-  void SetMaxRawNoise(Float_t ns=9.){fMaxRawNoise=ns;}
-  void SetNSigmaNoise(Float_t ns=4.){fNSigmaNoise=ns;}
-  void SetNSigmaGain(Float_t sig=3.){fNSigmaGain=sig;}
-  Bool_t IsAnodeGood(Int_t iAnode)const{ return fGoodAnode[iAnode];}
-  Float_t GetAnodeBaseline(Int_t iAnode) const{
-    if(fNBaseEvents>0) return fSumBaseline[iAnode]/fNBaseEvents;
-    else return 0;
-  }
-  Float_t GetAnodeRawNoise(Int_t iAnode) const{
-    if(fNBaseEvents>0) return TMath::Sqrt(fSumRawNoise[iAnode]/fNBaseEvents-TMath::Power(GetAnodeBaseline(iAnode),2));
-    
-    else return 0;
-  }
-  Float_t CalcMeanRawNoise() const;
-  void StatGain(Float_t &mean, Float_t  &rms);
-  Float_t GetAnodeCommonMode(Int_t iAnode) const{
-    if(fNBaseEvents>0) return fSumCMN[iAnode]/fNBaseEvents;
-    else return 0;
-  }
-  Float_t GetChannelGain(Int_t iAnode)const{
-    if(fNTPEvents>0) return fSumTPPeak[iAnode]/fNTPEvents;
-    else return 0;
-  }
-  Int_t GetNBaseEvents() const {return fNBaseEvents;}
-  Int_t GetNTPEvents() const {return fNTPEvents;}
-  void WriteToASCII();
-
- protected:
-
- private:
-
-  Int_t fNBaseEvents;                // number of "empty" events
-  Int_t fNTPEvents;                  // number of "Test Pulse" events
-  Bool_t fGoodAnode[fgkNAnodes];     // anode quality: good(1) - bad (0)
-  Float_t fSumBaseline[fgkNAnodes];  // baseline summed over events
-  Float_t fSumRawNoise[fgkNAnodes];  // noise summed over events
-  Float_t fSumCMN[fgkNAnodes];       // common mode noise coeff.
-  Float_t fSumTPPeak[fgkNAnodes];    // Test Pulse ampl. summed over events
-  Float_t fTPPos[fgkNAnodes];        // Test pulse peak position
-  Float_t fMinBaseline;              // Cut value for minimum baseline
-  Float_t fMaxBaseline;              // Cut value for maximum baseline
-  Float_t fMinRawNoise;              // Cut value for minimum noise
-  Float_t fMaxRawNoise;              // Cut value for maximum noise
-  Float_t fNSigmaNoise;              // Cut value for noise (n*sigma)
-  Float_t fNSigmaGain;               // Cut value for gain (n*sigma)
-
-  ClassDef(AliITSOnlineSDDBTP,1);
-};
-#endif
index 2dc55fb..58a62ea 100644 (file)
@@ -39,7 +39,7 @@ ClassImp(AliITSOnlineSDDBase)
   SetNSigmaNoise();
 }
 //______________________________________________________________________
-  AliITSOnlineSDDBase::AliITSOnlineSDDBase(Int_t mod, Int_t sid):AliITSOnlineSDD(mod,sid),fNEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.)
+  AliITSOnlineSDDBase::AliITSOnlineSDDBase(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fNEvents(0),fMinBaseline(0.),fMaxBaseline(0.),fMinRawNoise(0.),fMaxRawNoise(0.),fNSigmaNoise(0.)
 {
   // default constructor
   Reset();
@@ -156,7 +156,7 @@ void AliITSOnlineSDDBase::WriteToASCII(){
   //
   Char_t outfilnam[100];
   Float_t basMin=GetMinimumBaseline();
-  sprintf(outfilnam,"SDDbase_step1_mod%03d_sid%d.data",fModuleId,fSide);
+  sprintf(outfilnam,"SDDbase_step1_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* outf=fopen(outfilnam,"w");
   Float_t corrnoise=2.;
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
index 63d13a2..c9fd05c 100644 (file)
@@ -16,7 +16,7 @@ class AliITSOnlineSDDBase : public AliITSOnlineSDD {
 
  public:
   AliITSOnlineSDDBase();
-  AliITSOnlineSDDBase(Int_t mod, Int_t sid);
+  AliITSOnlineSDDBase(Int_t nddl, Int_t ncarlos, Int_t sid);
   virtual ~AliITSOnlineSDDBase();
   void Reset();
   void AddEvent(TH2F* hrawd);
index 817e0ff..62f4acc 100644 (file)
@@ -39,7 +39,7 @@ ClassImp(AliITSOnlineSDDCMN)
   SetNSigmaNoise();
 }
 //______________________________________________________________________
-  AliITSOnlineSDDCMN::AliITSOnlineSDDCMN(Int_t mod, Int_t sid):AliITSOnlineSDD(mod,sid),fNEvents(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.)
+  AliITSOnlineSDDCMN::AliITSOnlineSDDCMN(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fNEvents(0),fMinCorrNoise(0.),fMaxCorrNoise(0.),fNSigmaNoise(0.)
 {
   // default constructor
   Reset();
@@ -68,10 +68,10 @@ void AliITSOnlineSDDCMN::Reset(){
 void AliITSOnlineSDDCMN::ReadBaselines(){
   // assume baselines and good anodes are taken from previous run
   Char_t basfilnam[100];
-  sprintf(basfilnam,"SDDbase_step1_mod%03d_sid%d.data",fModuleId,fSide);
+  sprintf(basfilnam,"SDDbase_step1_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* basf=fopen(basfilnam,"r");
   if(basf==0){
-    AliWarning("Baselinefile not present, Set all baselines to 50\n");
+    AliWarning("Baseline file not present, Set all baselines to 50\n");
     for(Int_t ian=0;ian<fgkNAnodes;ian++){ 
       fBaseline[ian]=50.;
       fEqBaseline[ian]=50;
@@ -159,7 +159,7 @@ Float_t AliITSOnlineSDDCMN::CalcMeanNoise() const{
 void AliITSOnlineSDDCMN::WriteToASCII(){
   //
   Char_t outfilnam[100];
-  sprintf(outfilnam,"SDDbase_step2_mod%03d_sid%d.data",fModuleId,fSide);
+  sprintf(outfilnam,"SDDbase_step2_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* outf=fopen(outfilnam,"w");
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     fprintf(outf,"%d %d %8.3f %d %d %8.3f %8.3f %8.3f\n",ian,IsAnodeGood(ian),GetAnodeBaseline(ian),GetAnodeEqualizedBaseline(ian),GetAnodeBaselineOffset(ian),GetAnodeRawNoise(ian),GetAnodeCommonMode(ian),GetAnodeCorrNoise(ian));
@@ -171,7 +171,7 @@ void AliITSOnlineSDDCMN::WriteToASCII(){
 TH1F* AliITSOnlineSDDCMN::GetBaselineAnodeHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hb%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hbd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->SetBinContent(ian+1,GetAnodeBaseline(ian));
@@ -182,7 +182,7 @@ TH1F* AliITSOnlineSDDCMN::GetBaselineAnodeHisto() const {
 TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hn%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hnd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->SetBinContent(ian+1,GetAnodeRawNoise(ian));
@@ -193,7 +193,7 @@ TH1F* AliITSOnlineSDDCMN::GetRawNoiseAnodeHisto() const {
 TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hc%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hcd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->SetBinContent(ian+1,GetAnodeCorrNoise(ian));
@@ -204,7 +204,7 @@ TH1F* AliITSOnlineSDDCMN::GetCorrNoiseAnodeHisto() const {
 TH1F* AliITSOnlineSDDCMN::GetBaselineHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hdb%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hdbd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",100,0.,150.);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->Fill(GetAnodeBaseline(ian));
@@ -215,7 +215,7 @@ TH1F* AliITSOnlineSDDCMN::GetBaselineHisto() const {
 TH1F* AliITSOnlineSDDCMN::GetRawNoiseHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hdn%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hdnd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",100,0.,8.);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->Fill(GetAnodeRawNoise(ian));
@@ -226,7 +226,7 @@ TH1F* AliITSOnlineSDDCMN::GetRawNoiseHisto() const {
 TH1F* AliITSOnlineSDDCMN::GetCorrNoiseHisto() const {
   //
   Char_t hisnam[20];  
-  sprintf(hisnam,"hdc%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hdcd%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F* h=new TH1F(hisnam,"",100,0.,8.);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     h->Fill(GetAnodeCorrNoise(ian));
@@ -242,15 +242,15 @@ Bool_t AliITSOnlineSDDCMN::WriteToROOT(TFile *fil){
   }
   Char_t hisnam[20];
   fil->cd();
-  sprintf(hisnam,"hgood%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hgood%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hgood(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hbase%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hbase%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hbase(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hnois%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hnois%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hnois(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hcmn%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hcmn%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hcmn(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hcorn%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hcorn%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hcorn(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     hgood.SetBinContent(ian+1,float(IsAnodeGood(ian)));
index ef5f2b3..36155e4 100644 (file)
@@ -16,7 +16,7 @@ class AliITSOnlineSDDCMN : public AliITSOnlineSDD {
 
  public:
   AliITSOnlineSDDCMN();
-  AliITSOnlineSDDCMN(Int_t mod, Int_t sid);
+  AliITSOnlineSDDCMN(Int_t nddl, Int_t ncarlos, Int_t sid);
   virtual ~AliITSOnlineSDDCMN();
   void Reset();
   void AddEvent(TH2F* hrawd);
index 85ad7de..944c345 100644 (file)
@@ -45,7 +45,7 @@ AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors():AliITSOnlineSDD(),fHisto(),
   SetTimeDiffTB();
 }
 //______________________________________________________________________
-AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors(Int_t mod, Int_t sid):AliITSOnlineSDD(mod,sid),fHisto(),fTbZero(0.),fParam(),fPolOrder(0),fMinDriftVel(0.),fMaxDriftVel(0.),fThreshold(0.),fTimeDiffTB()
+AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fHisto(),fTbZero(0.),fParam(),fPolOrder(0),fMinDriftVel(0.),fMaxDriftVel(0.),fThreshold(0.),fTimeDiffTB()
 { 
 // standard constructor
   SetMinDriftVel();
@@ -390,7 +390,7 @@ void AliITSOnlineSDDInjectors::PrintCentroids(){
 void AliITSOnlineSDDInjectors::WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend){
   //
   Char_t outfilnam[100];
-  sprintf(outfilnam,"SDDinj_mod%03d_sid%d.data",fModuleId,fSide);
+  sprintf(outfilnam,"SDDinj_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);  
   FILE* outf;
   if(optAppend==0){ 
     outf=fopen(outfilnam,"w");
index fe17876..d22dd03 100644 (file)
@@ -17,7 +17,7 @@ class AliITSOnlineSDDInjectors : public AliITSOnlineSDD {
 
  public:
   AliITSOnlineSDDInjectors();      
-  AliITSOnlineSDDInjectors(Int_t mod, Int_t sid);
+  AliITSOnlineSDDInjectors(Int_t nddl, Int_t ncarlos, Int_t sid);
   virtual ~AliITSOnlineSDDInjectors();
 
   void SetSide(Int_t sid){fSide=sid;}
index 4ecdfdc..ba9a3d5 100644 (file)
@@ -38,7 +38,7 @@ AliITSOnlineSDDTP::AliITSOnlineSDDTP():AliITSOnlineSDD(),fDAC(0.),fNSigmaGain(0.
   SetNSigmaNoise();
 }
 //______________________________________________________________________
-AliITSOnlineSDDTP::AliITSOnlineSDDTP(Int_t mod, Int_t sid, Float_t xDAC):AliITSOnlineSDD(mod,sid),fDAC(xDAC),fNSigmaGain(0.),fNSigmaNoise(0.)
+AliITSOnlineSDDTP::AliITSOnlineSDDTP(Int_t nddl, Int_t ncarlos, Int_t sid, Float_t xDAC):AliITSOnlineSDD(nddl,ncarlos,sid),fDAC(xDAC),fNSigmaGain(0.),fNSigmaNoise(0.)
 {
   // standard constructor
   Reset();
@@ -90,7 +90,7 @@ void AliITSOnlineSDDTP::AddEvent(TH2F* hrawd){
 void AliITSOnlineSDDTP::ReadBaselines(){
   // assume baselines and good anodes are taken from previous run
   Char_t basfilnam[100];
-  sprintf(basfilnam,"SDDbase_step2_mod%03d_sid%d.data",fModuleId,fSide);
+  sprintf(basfilnam,"SDDbase_step2_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* basf=fopen(basfilnam,"r");
   if(basf==0){
     AliWarning("Baselinefile not present, Set all baselines to 50\n");
@@ -168,9 +168,9 @@ void AliITSOnlineSDDTP::StatGain(Float_t &mean, Float_t  &rms){
 void AliITSOnlineSDDTP::WriteToASCII(){
   //
   Char_t outfilnam[100];
-  sprintf(outfilnam,"SDDbase_mod%03d_sid%d.data",fModuleId,fSide);
+  sprintf(outfilnam,"SDDbase_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
   FILE* outf=fopen(outfilnam,"w");
-  fprintf(outf,"%d %d %d\n",fModuleId,fSide,IsModuleGood());
+  fprintf(outf,"%d %d %d\n",fCarlos,fSide,IsModuleGood());
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     fprintf(outf,"%d %d %8.3f %d %d %8.3f %8.3f %8.3f %8.3f\n",ian,IsAnodeGood(ian),GetAnodeBaseline(ian),GetAnodeEqualizedBaseline(ian),GetAnodeBaselineOffset(ian),GetAnodeRawNoise(ian),GetAnodeCommonMode(ian),GetAnodeCorrNoise(ian),GetChannelGain(ian));
   }
@@ -185,17 +185,17 @@ Bool_t AliITSOnlineSDDTP::WriteToROOT(TFile *fil){
   }
   Char_t hisnam[20];
   fil->cd();
-  sprintf(hisnam,"hgood%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hgood%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hgood(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hbase%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hbase%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hbase(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hnois%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hnois%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hnois(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hcmn%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hcmn%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hcmn(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hcorn%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hcorn%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hcorn(hisnam,"",256,-0.5,255.5);
-  sprintf(hisnam,"hgain%03ds%d",fModuleId,fSide);
+  sprintf(hisnam,"hgain%02dc%02ds%d",fDDL,fCarlos,fSide);
   TH1F hgain(hisnam,"",256,-0.5,255.5);
   for(Int_t ian=0;ian<fgkNAnodes;ian++){
     hgood.SetBinContent(ian+1,float(IsAnodeGood(ian)));
index d8d013b..c91e302 100644 (file)
@@ -16,7 +16,7 @@ class AliITSOnlineSDDTP : public AliITSOnlineSDD {
 
  public:
   AliITSOnlineSDDTP();
-  AliITSOnlineSDDTP(Int_t mod, Int_t sid,Float_t xDAC);
+  AliITSOnlineSDDTP(Int_t nddl, Int_t ncarlos, Int_t sid, Float_t xDAC);
   virtual ~AliITSOnlineSDDTP();
   void Reset();
   void AddEvent(TH2F* hrawd);
index ead8547..ae290ce 100644 (file)
@@ -1,17 +1,36 @@
-/////////////////////////////////////////
-// Class for SDD digits preprocessing  //
-//                                     //
-//                                     //
-////////////////////////////////////////
+/**************************************************************************
+ * Copyright(c) 2007-2009, 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$ */
 
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Implementation of the class for SDD preprocessing             //
+// Origin: E.Crescio, Torino, crescio@to.infn.it                 //
+//         F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
 #include "AliITSPreprocessorSDD.h"
 #include "AliITSCalibrationSDD.h"
 #include "AliITSDriftSpeedSDD.h"
+#include "AliITSDDLModuleMapSDD.h"
 #include "AliITSDriftSpeedArraySDD.h"
 #include "AliITSDCSAnalyzerSDD.h"
 #include "AliShuttleInterface.h"
+#include "AliCDBEntry.h"
 #include "AliCDBMetaData.h"
 #include "TObjArray.h"
 #include "AliLog.h"
@@ -19,8 +38,6 @@
 #include <TSystem.h>
 #include <TList.h>
 
-const Int_t AliITSPreprocessorSDD::fgkNumberOfSDD = 260;
-const Int_t AliITSPreprocessorSDD::fgkNumberOfChannels = 512;
 const TString AliITSPreprocessorSDD::fgkNameHistoPedestals = "hpedestal";
 const TString AliITSPreprocessorSDD::fgkNameHistoNoise = "hnoise";
 ClassImp(AliITSPreprocessorSDD)
@@ -28,24 +45,35 @@ ClassImp(AliITSPreprocessorSDD)
 
 UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
 
-  //preprocessing. 
+  // Get DDL map from OCDB
+  AliCDBEntry* entry = GetFromOCDB("Calib", "DDLMapSDD");
+  if(!entry){
+    Log("DDL map file not found in OCDB.");  
+    return 2;
+  }
+  AliITSDDLModuleMapSDD* ddlmap = (AliITSDDLModuleMapSDD*)entry->GetObject();
+  if(!ddlmap){ 
+    Log("AliITSDDLModuleMapSDD object not in file.");
+    return 2;
+  }
 
+  //preprocessing
   TString runType = GetRunType();
   Bool_t retcode;
   Char_t command[100];
   Char_t inpFileName[100];
   AliCDBMetaData *md1= new AliCDBMetaData();
-  md1->SetResponsible("Elisabetta Crescio, Francesco Prino");
+  md1->SetResponsible("Francesco Prino");
   md1->SetBeamPeriod(0);
   md1->SetAliRootVersion("head 30 November 2007"); //root version
   md1->SetComment("This is a test");
 
   if (runType == "PULSER_RUN"){
-    TObjArray calSDD(fgkNumberOfSDD);
+    TObjArray calSDD(kNumberOfSDD);
     calSDD.SetOwner(kFALSE);
     Float_t baseline,rawnoise,cmn,corn,gain;
     Int_t isgoodan,i,im,is,isgoodmod,basmin,basoff;
-    Int_t numOfBadChannels[fgkNumberOfSDD];
+    Int_t numOfBadChannels[kNumberOfSDD];
   
     TList* sourceList = GetFileSources(kDAQ, "SDD_Calib");
     if (!sourceList){ 
@@ -67,47 +95,52 @@ UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
     }
     delete sourceList;
 
-    for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
-      AliITSCalibrationSDD *cal = new AliITSCalibrationSDD("simulated");
-      numOfBadChannels[imod]=0;
-      Int_t badch[fgkNumberOfChannels];
-      for(Int_t isid=0;isid<=1;isid++){
-       sprintf(inpFileName,"./SDDbase_mod%03d_sid%d.data",imod,isid);
-       FILE* basFil = fopen(inpFileName,"read");
-       if (basFil == 0) {
-        Log(Form("File %s not found.",inpFileName));
-        return 2;
-       }      
-       fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod);
-       if(!isgoodmod) cal->SetDead();
-       for(Int_t ian=0;ian<(fgkNumberOfChannels/2);ian++){
-        fscanf(basFil,"%d %d %f %d %d %f %f %f %f\n",&i,&isgoodan,&baseline,&basmin,&basoff,&rawnoise,&cmn,&corn,&gain);
-        Int_t ich=ian;
-        if(isid==1) ich+=256;
-        if(!isgoodan){ 
-          Int_t ibad=numOfBadChannels[imod];
-          numOfBadChannels[imod]++;
-          badch[ibad]=ich;
-        }
-        cal->SetBaseline(ich,baseline);
-        cal->SetNoiseAfterElectronics(ich,rawnoise);
-        Int_t iChip=cal->GetChip(ich);
-        Int_t iChInChip=cal->GetChipChannel(ich);
-        cal->SetGain(gain,isid,iChip,iChInChip);
-       }
-       cal->SetDeadChannels(numOfBadChannels[imod]);
-       for(Int_t ibad=0;ibad<numOfBadChannels[imod];ibad++){
-        cal->SetBadChannel(ibad,badch[ibad]);
-       }
-       fclose(basFil);
+    for(Int_t iddl=0;iddl<kNumberOfDDL;iddl++){
+      for(Int_t imod=0;imod<kModulesPerDDL;imod++){
+       Int_t modID=ddlmap->GetModuleNumber(iddl,imod);
+       if(modID==-1) continue;
+       modID-=240; // to have SDD modules numbering from 0 to 260
+       AliITSCalibrationSDD *cal = new AliITSCalibrationSDD("simulated");
+       numOfBadChannels[modID]=0;
+       Int_t badch[kNumberOfChannels];
+       for(Int_t isid=0;isid<=1;isid++){
+         sprintf(inpFileName,"./SDDbase_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
+         FILE* basFil = fopen(inpFileName,"read");
+         if (basFil == 0) {
+           Log(Form("File %s not found.",inpFileName));
+           return 2;
+         }
+         fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod);
+         if(!isgoodmod) cal->SetDead();
+         for(Int_t ian=0;ian<(kNumberOfChannels/2);ian++){
+           fscanf(basFil,"%d %d %f %d %d %f %f %f %f\n",&i,&isgoodan,&baseline,&basmin,&basoff,&rawnoise,&cmn,&corn,&gain);
+           Int_t ich=ian;
+           if(isid==1) ich+=256;
+           if(!isgoodan){ 
+             Int_t ibad=numOfBadChannels[modID];
+             badch[ibad]=ich;
+             numOfBadChannels[modID]++;
+           }
+           cal->SetBaseline(ich,baseline);
+           cal->SetNoiseAfterElectronics(ich,rawnoise);
+           Int_t iChip=cal->GetChip(ich);
+           Int_t iChInChip=cal->GetChipChannel(ich);
+           cal->SetGain(gain,isid,iChip,iChInChip);
+         }
+         cal->SetDeadChannels(numOfBadChannels[modID]);
+         for(Int_t ibad=0;ibad<numOfBadChannels[modID];ibad++){
+           cal->SetBadChannel(ibad,badch[ibad]);
+         }
+         fclose(basFil);
+       }
+       calSDD.AddAt(cal,modID);
       }
-      calSDD.Add(cal);
     }
     md1->SetObjectClassName("AliITSCalibration");
     retcode = Store("Calib","CalibSDD",&calSDD,md1, 0, kTRUE);
   }else if(runType == "PHYSICS"){
 
-    TObjArray vdrift(2*fgkNumberOfSDD);
+    TObjArray vdrift(2*kNumberOfSDD);
     vdrift.SetOwner(kFALSE);
     Int_t evNumb,polDeg; 
     UInt_t timeStamp;
@@ -132,24 +165,29 @@ UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
     }
     delete sourceList;
 
-    for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
-      for(Int_t isid=0;isid<=1;isid++){
-       AliITSDriftSpeedArraySDD *arr=new AliITSDriftSpeedArraySDD();
-       sprintf(inpFileName,"./SDDinj_mod%03d_sid%d.data",imod,isid);
-       FILE* injFil = fopen(inpFileName,"read");
-       if (injFil == 0) {
-         Log(Form("File %s not found.",inpFileName));
-         return 2;
-       }
-       fscanf(injFil,"%d",&polDeg);
-       while (!feof(injFil)){
-         fscanf(injFil,"%d %d",&evNumb,&timeStamp);
-         if(feof(injFil)) break;
-         for(Int_t ic=0;ic<4;ic++) fscanf(injFil,"%f",&param[ic]);
-         AliITSDriftSpeedSDD *dsp=new AliITSDriftSpeedSDD(evNumb,timeStamp,polDeg,param);
-         arr->AddDriftSpeed(dsp);
+    for(Int_t iddl=0;iddl<kNumberOfDDL;iddl++){
+      for(Int_t imod=0;imod<kModulesPerDDL;imod++){
+       Int_t modID=ddlmap->GetModuleNumber(iddl,imod);
+       if(modID==-1) continue;
+       modID-=240; // to have SDD modules numbering from 0 to 260
+       for(Int_t isid=0;isid<=1;isid++){
+         AliITSDriftSpeedArraySDD *arr=new AliITSDriftSpeedArraySDD();
+         sprintf(inpFileName,"./SDDinj_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
+         FILE* injFil = fopen(inpFileName,"read");
+         if (injFil == 0) {
+           Log(Form("File %s not found.",inpFileName));
+           return 2;
+         }
+         fscanf(injFil,"%d",&polDeg);
+         while (!feof(injFil)){
+           fscanf(injFil,"%d %d",&evNumb,&timeStamp);
+           if(feof(injFil)) break;
+           for(Int_t ic=0;ic<4;ic++) fscanf(injFil,"%f",&param[ic]);
+           AliITSDriftSpeedSDD *dsp=new AliITSDriftSpeedSDD(evNumb,timeStamp,polDeg,param);
+           arr->AddDriftSpeed(dsp);
+         }
+         vdrift.AddAt(arr,2*modID+isid);
        }
-       vdrift.Add(arr);
       }
     }
     md1->SetObjectClassName("AliITSDriftSpeedArraySDD");
@@ -162,9 +200,9 @@ UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
     // process DCS data
     AliITSDCSAnalyzerSDD *dcs=new AliITSDCSAnalyzerSDD();
     dcs->AnalyzeData(dcsAliasMap);
-    TObjArray refDCS(fgkNumberOfSDD);
+    TObjArray refDCS(kNumberOfSDD);
     refDCS.SetOwner(kFALSE);
-    for(Int_t imod=0;imod<fgkNumberOfSDD;imod++){
+    for(Int_t imod=0;imod<kNumberOfSDD;imod++){
       AliITSDCSDataSDD *dcsdata=dcs->GetDCSData(imod);
       refDCS.Add(dcsdata);
     }
index 4098c58..716dec7 100644 (file)
@@ -1,10 +1,15 @@
 #ifndef ALIITSPREPROCESSORSDD_H
 #define ALIITSPREPROCESSORSDD_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
 
 ////////////////////////////////////////////////////
-//  Class for the                                 //
-//  SDD beam test digit preprocessing             //
+//                                                //
+//  Class for SDD data preprocessing              //
 //  Origin: E. Crescio - crescio@to.infn.it       //
+//          F. Prino   - prino@to.infn.t          //
 //                                                //
 ////////////////////////////////////////////////////
 
@@ -21,7 +26,10 @@ class AliITSPreprocessorSDD : public AliPreprocessor {
     AliPreprocessor("SDD", shuttle){}
   virtual ~AliITSPreprocessorSDD(){;}
 
-
+  enum {kNumberOfSDD = 260};    // number of SDD modules
+  enum {kNumberOfDDL = 24};     // number of DDLs in SDD
+  enum {kModulesPerDDL = 12};   // number of modules in each DDL 
+  enum {kNumberOfChannels = 512}; // number of channels per module
 
  protected:      
 
@@ -29,12 +37,9 @@ class AliITSPreprocessorSDD : public AliPreprocessor {
   
   virtual UInt_t Process(TMap* dcsAliasMap);
 
-  static const Int_t fgkNumberOfSDD;       // number of SDD modules 
-  static const Int_t fgkNumberOfChannels;  // number of channels per module
-
   static const TString fgkNameHistoPedestals; //name of ped. histo
   static const TString fgkNameHistoNoise;  //name of noise histo
-  ClassDef(AliITSPreprocessorSDD,3)  // Alice ITS-SDD preprocessor.
+  ClassDef(AliITSPreprocessorSDD,4)  // Alice ITS-SDD preprocessor.
 
  };
 
index bfea49f..3d53c04 100644 (file)
 #include "AliLog.h"
 
 ClassImp(AliITSRawStreamSDD)
-
-const Int_t AliITSRawStreamSDD::fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL] = {
-  {240,241,242,246,247,248,252,253,254,258,259,260},
-  {264,265,266,270,271,272,276,277,278,282,283,284},
-  {288,289,290,294,295,296,300,301,302,306,307,308},
-  {312,313,314,318,319,320,-1,-1,-1,-1,-1,-1},
-  {243,244,245,249,250,251,255,256,257,261,262,263},
-  {267,268,269,273,274,275,279,280,281,285,286,287},
-  {291,292,293,297,298,299,303,304,305,309,310,311},
-  {315,316,317,321,322,323,-1,-1,-1,-1,-1,-1},
-  {324,325,326,327,332,333,334,335,340,341,342,343},
-  {348,349,350,351,356,357,358,359,364,365,366,367},
-  {372,373,374,375,380,381,382,383,388,389,390,391},
-  {396,397,398,399,404,405,406,407,412,413,414,415},
-  {420,421,422,423,428,429,430,431,436,437,438,439},
-  {444,445,446,447,452,453,454,455,460,461,462,463},
-  {468,469,470,471,476,477,478,479,484,485,486,487},
-  {492,493,494,495,-1,-1,-1,-1,-1,-1,-1,-1},
-  {328,329,330,331,336,337,338,339,344,345,346,347},
-  {352,353,354,355,360,361,362,363,368,369,370,371},
-  {376,377,378,379,384,385,386,387,392,393,394,395},
-  {400,401,402,403,408,409,410,411,416,417,418,419},
-  {424,425,426,427,432,433,434,435,440,441,442,443},
-  {448,449,450,451,456,457,458,459,464,465,466,467},
-  {472,473,474,475,480,481,482,483,488,489,490,491},
-  {496,497,498,499,-1,-1,-1,-1,-1,-1,-1,-1}};
   
 const UInt_t AliITSRawStreamSDD::fgkCodeLength[8] =  {8, 18, 2, 3, 4, 5, 6, 7};
 
+//______________________________________________________________________
 AliITSRawStreamSDD::AliITSRawStreamSDD(AliRawReader* rawReader) :
   AliITSRawStream(rawReader),
+fDDLModuleMap(0),
 fData(0),
 fEventId(0),
 fCarlosId(-1),
@@ -69,7 +44,8 @@ fEndWords(0),
 fResetSkip(0)
 {
 // create an object to read ITS SDD raw digits
-
+  fDDLModuleMap=new AliITSDDLModuleMapSDD();
+  fDDLModuleMap->SetDefaultMap();
   Reset();
   for(Int_t i=0;i<kFifoWords;i++) fNfifo[i]=0;
   for(Int_t i=0;i<kDDLsNumber;i++) fSkip[i]=0;
@@ -80,6 +56,36 @@ fResetSkip(0)
   for(Short_t i=0; i<kFifoWords; i++) fIFifoWord[i]=0x30000010 + i;  // 805306384+i;
 }
 
+//______________________________________________________________________
+AliITSRawStreamSDD::AliITSRawStreamSDD(const AliITSRawStreamSDD& rs) :
+AliITSRawStream(rs.fRawReader),
+fDDLModuleMap(rs.fDDLModuleMap),
+fData(0),
+fEventId(0),
+fCarlosId(-1),
+fChannel(0),
+fJitter(0),
+fNCarlos(kModulesPerDDL),
+fDDL(0),
+fEndWords(0),
+fResetSkip(0)
+{
+  // copy constructor
+  AliError("Copy constructor should not be used.");
+}
+//__________________________________________________________________________
+AliITSRawStreamSDD& AliITSRawStreamSDD::operator=(const AliITSRawStreamSDD& rs) {
+  // assignment operator
+  if (this!=&rs) {}
+  AliError("Assignment opertator should not be used.");
+  return *this;
+}
+
+//______________________________________________________________________
+AliITSRawStreamSDD::~AliITSRawStreamSDD(){
+  if(fDDLModuleMap) delete fDDLModuleMap;
+}
+//______________________________________________________________________
 UInt_t AliITSRawStreamSDD::ReadBits()
 {
 // read bits from the given channel
@@ -89,6 +95,7 @@ UInt_t AliITSRawStreamSDD::ReadBits()
   return result;
 }
 
+//______________________________________________________________________
 Int_t AliITSRawStreamSDD::DecompAmbra(Int_t value) const
 {
   // AMBRA decompression (from 8 to 10 bit)
@@ -105,6 +112,7 @@ Int_t AliITSRawStreamSDD::DecompAmbra(Int_t value) const
   
 }
 
+//______________________________________________________________________
 Bool_t AliITSRawStreamSDD::Next()
 {
 // read the next raw digit
@@ -192,7 +200,7 @@ Bool_t AliITSRawStreamSDD::Next()
       
       if (fNCarlos == 8 && fCarlosId >= 8) continue;  // old data, fNCarlos = 8;
       if(fCarlosId>=0 && fCarlosId <kModulesPerDDL){
-        fModuleID = fgkDDLModuleMap[ddln][fCarlosId];
+        fModuleID = GetModuleNumber(ddln,fCarlosId);
       }
     } else {  // decode data
       if (fReadCode[fCarlosId][fChannel]) {// read the next code word
@@ -222,6 +230,7 @@ Bool_t AliITSRawStreamSDD::Next()
   return kFALSE;
 }
 
+//______________________________________________________________________
 void AliITSRawStreamSDD::Reset(){
 
   //reset data member for a new ddl
@@ -240,6 +249,7 @@ void AliITSRawStreamSDD::Reset(){
   for(Int_t i=0;i<kModulesPerDDL;i++) fICountFoot[i]=0;
 }
 
+//______________________________________________________________________
 Bool_t AliITSRawStreamSDD::ResetSkip(Int_t ddln){
   // skip the 1 DDL header word = 0xffffffff
   Bool_t startCount=kFALSE;
index c874827..6747a27 100644 (file)
@@ -12,6 +12,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliITSRawStream.h"
+#include "AliITSDDLModuleMapSDD.h"
 
 class AliRawReader;
 
@@ -19,7 +20,9 @@ class AliRawReader;
 class AliITSRawStreamSDD: public AliITSRawStream {
   public :
     AliITSRawStreamSDD(AliRawReader* rawReader);
-    virtual ~AliITSRawStreamSDD() {};
+    AliITSRawStreamSDD(const AliITSRawStreamSDD& rs);
+    AliITSRawStreamSDD& operator=(const AliITSRawStreamSDD& rs);
+    virtual ~AliITSRawStreamSDD();
 
     virtual Bool_t   Next();
 
@@ -28,12 +31,15 @@ class AliITSRawStreamSDD: public AliITSRawStream {
     virtual Int_t    GetChannel() const {return fChannel;}
     virtual Int_t    ReadJitter() const {return 0;}
     virtual Int_t    GetCarlosId() const {return fCarlosId;}
+    virtual Int_t    GetEventId() const {return fEventId;}
 
+    virtual void SetDDLModuleMap(AliITSDDLModuleMapSDD* ddlsdd){fDDLModuleMap->SetDDLMap(ddlsdd);}
     virtual void     SetLowCarlosThreshold(Int_t th, Int_t i) 
       {fLowThreshold[i]=th;}
     virtual void     SetNCarlos(Int_t nC=12){fNCarlos=nC;}
-    static  Int_t    GetModuleNumber(UInt_t iDDL, UInt_t iModule)
-                     {return fgkDDLModuleMap[iDDL][iModule];}
+    Int_t   GetModuleNumber(UInt_t iDDL, UInt_t iModule) const {
+      return fDDLModuleMap->GetModuleNumber(iDDL,iModule);
+    }
     virtual void     Reset(); 
     virtual Bool_t   ResetSkip(Int_t ddln); 
 
@@ -46,13 +52,12 @@ class AliITSRawStreamSDD: public AliITSRawStream {
       kDataFormatErr = 2
     };
   protected:
-    static const Int_t fgkDDLModuleMap[kDDLsNumber][kModulesPerDDL]; //  mapping DDL/module -> module number
-
     virtual UInt_t   ReadBits();
     virtual Int_t    DecompAmbra(Int_t value) const;
 
     static const UInt_t fgkCodeLength[8]; //code length
 
+    AliITSDDLModuleMapSDD* fDDLModuleMap; // mapping DDL/module -> module number 
     UInt_t           fData;         // data read for file
     Int_t            fSkip[kDDLsNumber];// number of skipped words
     Int_t            fEventId;      // event ID from header
diff --git a/ITS/Calib/DDLMapSDD/Run0_9999999_v0_s0.root b/ITS/Calib/DDLMapSDD/Run0_9999999_v0_s0.root
new file mode 100644 (file)
index 0000000..1ced65e
Binary files /dev/null and b/ITS/Calib/DDLMapSDD/Run0_9999999_v0_s0.root differ
index cd3dcdc..6701626 100644 (file)
@@ -5,7 +5,7 @@
 - DA Type: - LDC
 - Number of events needed: 100
 - Input Files: - 
-- Output Files: - SDDbase_step1_mod*_sid*.data SDDbase_step2_mod*_sid*.data
+- Output Files: - SDDbase_step1_ddl*c*_sid*.data SDDbase_step2_ddl*c*_sid*.data
 - Trigger types used: 
 */
 
@@ -65,7 +65,7 @@ int main(int argc, char **argv) {
                                         "TStreamerInfo()");
 
   /* log start of process */
-  printf("ITS SDD BASE algorithm program started\n");  
+  printf("ITS SDD BASELINE+NOISE algorithm program started\n");  
 
 
   /* check that we got some arguments = list of files */
@@ -78,19 +78,22 @@ int main(int argc, char **argv) {
   Int_t eqOffset = 256;
   Int_t DDLrange = 24;
   Int_t maxNEvents=18; // maximum number of events to be analyzed
-  const Int_t nSDDmodules=260;  // temp for test raw data
-  AliITSOnlineSDDBase **base=new AliITSOnlineSDDBase*[2*nSDDmodules];
-  AliITSOnlineSDDCMN **corr=new AliITSOnlineSDDCMN*[2*nSDDmodules];
-  TH2F **histo=new TH2F*[2*nSDDmodules];
+  const Int_t kTotDDL=24;
+  const Int_t kModPerDDL=12;
+  const Int_t kSides=2;
+  AliITSOnlineSDDBase **base=new AliITSOnlineSDDBase*[kTotDDL*kModPerDDL*kSides];
+  AliITSOnlineSDDCMN **corr=new AliITSOnlineSDDCMN*[kTotDDL*kModPerDDL*kSides];
+  TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
 
   Char_t hisnam[20];
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0;isid<2;isid++){
-      Int_t index=2*imod+isid;
-      base[index]=new AliITSOnlineSDDBase(imod,isid);
-      corr[index]=new AliITSOnlineSDDCMN(imod,isid);
-      sprintf(hisnam,"his%03ds%d",imod,isid);
-      histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       base[index]=new AliITSOnlineSDDBase(iddl,imod,isid);
+       sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
+       histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+      }
     }
   }
   
@@ -101,10 +104,12 @@ int main(int argc, char **argv) {
     printf("Start Analysis Step %d\n",iStep);
     iev=0;
     if(iStep==1){
-      for(Int_t imod=0; imod<nSDDmodules;imod++){
-       for(Int_t isid=0;isid<2;isid++){
-         Int_t index=2*imod+isid;
-         corr[index]->Reset();
+      for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+       for(Int_t imod=0; imod<kModPerDDL;imod++){
+         for(Int_t isid=0;isid<kSides;isid++){
+           Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+           corr[index]=new AliITSOnlineSDDCMN(iddl,imod,isid);
+         }
        }
       }
     }
@@ -176,28 +181,32 @@ int main(int argc, char **argv) {
          }
 
          rawReader->Reset();
-         for(Int_t imod=0; imod<nSDDmodules;imod++){
-           for(Int_t isid=0; isid<2;isid++){
-             Int_t index=2*imod+isid;
-             histo[index]->Reset();
+         for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+           for(Int_t imod=0; imod<kModPerDDL;imod++){
+             for(Int_t isid=0;isid<kSides;isid++){
+               Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+               histo[index]->Reset();
+             }
            }
          }
          AliITSRawStreamSDD s(rawReader);
 
          while(s.Next()){
-           Int_t isddmod=s.GetModuleID();//Number(iddl,s.GetCarlosId());           
-           isddmod-=240;  // to have SDD modules from 0 to 259
-           if(isddmod>0 && isddmod<nSDDmodules && s.IsCompletedModule()==kFALSE){ 
-             Int_t index=2*isddmod+s.GetChannel(); 
+           Int_t iDDL=rawReader->GetDDLID();
+           Int_t iCarlos=s.GetCarlosId();
+           if(iDDL>=0 && iDDL<kTotDDL && s.IsCompletedModule()==kFALSE){ 
+             Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel(); 
              histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
            }
          }
          delete rawReader;
-         for(Int_t imod=0; imod<nSDDmodules;imod++){
-           for(Int_t isid=0; isid<2;isid++){
-             Int_t index=2*imod+isid;
-             if(iStep==0) base[index]->AddEvent(histo[index]);    
-             if(iStep==1) corr[index]->AddEvent(histo[index]);    
+         for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+           for(Int_t imod=0; imod<kModPerDDL;imod++){
+             for(Int_t isid=0;isid<kSides;isid++){
+               Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+               if(iStep==0) base[index]->AddEvent(histo[index]);
+               if(iStep==1) corr[index]->AddEvent(histo[index]);
+             }
            }
          }
 
@@ -205,22 +214,19 @@ int main(int argc, char **argv) {
          free(event);
        }
       }
-    
     }
-    
-    for(Int_t imod=0; imod<nSDDmodules;imod++){
-      for(Int_t isid=0; isid<2;isid++){
-       Int_t index=2*imod+isid;
-       if(iStep==0){
-         base[index]->ValidateAnodes();
-         base[index]->WriteToASCII();
-       }
-       if(iStep==1){
-         corr[index]->ValidateAnodes();
-         corr[index]->WriteToASCII();
+
+    if(iStep==0){
+      for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+       for(Int_t imod=0; imod<kModPerDDL;imod++){
+         for(Int_t isid=0;isid<kSides;isid++){
+           Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+           base[index]->ValidateAnodes();
+           base[index]->WriteToASCII();
+         }
        }
-      }
-    }  
+      }  
+    }
   }
 
   /* write report */
@@ -232,10 +238,14 @@ int main(int argc, char **argv) {
 
 
   TFile *fh=new TFile("SDDbaseHistos.root","RECREATE");
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0; isid<2;isid++){
-      Int_t index=2*imod+isid;
-      corr[index]->WriteToROOT(fh);
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       corr[index]->ValidateAnodes();
+       corr[index]->WriteToASCII();
+       corr[index]->WriteToROOT(fh);
+      }
     }
   }
   fh->Close();
index e4ebeba..132cfc9 100644 (file)
@@ -4,8 +4,8 @@
 - Run Type: - PULSER_RUN
 - DA Type: - LDC
 - Number of events needed: 100
-- Input Files: - SDDbase_step2_mod*_sid*.data
-- Output Files: - SDDbase_mod*_sid*.data
+- Input Files: - SDDbase_step1_ddl*c*_sid*.data
+- Output Files: - SDDbase_ddl*c*_sid*.data
 - Trigger types used: 
 */
 
@@ -64,7 +64,7 @@ int main(int argc, char **argv) {
                                         "TStreamerInfo()");
 
   /* log start of process */
-  printf("ITS SDD TP algorithm program started\n");  
+  printf("ITS SDD TEST-PULSE algorithm program started\n");  
 
 
   /* check that we got some arguments = list of files */
@@ -77,18 +77,23 @@ int main(int argc, char **argv) {
   Int_t eqOffset = 256;
   Int_t DDLrange = 24;
   Int_t maxNEvents=15; // maximum number of events to be analyzed
-  const Int_t nSDDmodules=260;  // temp for test raw data
-  AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[2*nSDDmodules];
-  TH2F **histo=new TH2F*[2*nSDDmodules];
-  Bool_t isFilled[2*nSDDmodules];
+  const Int_t kTotDDL=24;
+  const Int_t kModPerDDL=12;
+  const Int_t kSides=2;
+
+  AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[kTotDDL*kModPerDDL*kSides];
+  TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
+  Bool_t isFilled[kTotDDL*kModPerDDL*kSides];
   Char_t hisnam[20];
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0;isid<2;isid++){
-      Int_t index=2*imod+isid;
-      tpan[index]=new AliITSOnlineSDDTP(imod,isid,100.);
-      sprintf(hisnam,"his%03ds%d",imod,isid);
-      histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
-      isFilled[index]=0;
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       tpan[index]=new AliITSOnlineSDDTP(iddl,imod,isid,100.);
+       sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
+       histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+       isFilled[index]=0;
+      }
     }
   }
   
@@ -160,28 +165,32 @@ int main(int argc, char **argv) {
        }
 
        rawReader->Reset();
-       for(Int_t imod=0; imod<nSDDmodules;imod++){
-         for(Int_t isid=0; isid<2;isid++){
-           Int_t index=2*imod+isid;
-           histo[index]->Reset();
+       for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+         for(Int_t imod=0; imod<kModPerDDL;imod++){
+           for(Int_t isid=0;isid<kSides;isid++){
+             Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+             histo[index]->Reset();
+           }
          }
        }
        AliITSRawStreamSDD s(rawReader);
        
        while(s.Next()){
-         Int_t isddmod=s.GetModuleID();//Number(iddl,s.GetCarlosId()); 
-         isddmod-=240;  // to have SDD modules from 0 to 259
-         if(isddmod>0 && isddmod<nSDDmodules && s.IsCompletedModule()==kFALSE){ 
-           Int_t index=2*isddmod+s.GetChannel(); 
+         Int_t iDDL=rawReader->GetDDLID();
+         Int_t iCarlos=s.GetCarlosId();
+         if(iDDL>=0 && iDDL<kTotDDL && s.IsCompletedModule()==kFALSE){ 
+           Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel(); 
            histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
            isFilled[index]=1;
          }
        }
        delete rawReader;
-       for(Int_t imod=0; imod<nSDDmodules;imod++){
-         for(Int_t isid=0; isid<2;isid++){
-           Int_t index=2*imod+isid;
-           if(isFilled[index]) tpan[index]->AddEvent(histo[index]);    
+       for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+         for(Int_t imod=0; imod<kModPerDDL;imod++){
+           for(Int_t isid=0;isid<kSides;isid++){
+             Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+             if(isFilled[index]) tpan[index]->AddEvent(histo[index]);    
+           }
          }
        }
        
@@ -195,16 +204,18 @@ int main(int argc, char **argv) {
     
   TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
   Char_t filnam[100],command[120];
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0; isid<2;isid++){
-      Int_t index=2*imod+isid;
-      if(isFilled[index]){
-       tpan[index]->ValidateAnodes();
-       tpan[index]->WriteToASCII();
-       tpan[index]->WriteToROOT(fh);
-       sprintf(filnam,"SDDbase_mod%03d_sid%d.data",imod,isid);
-       sprintf(command,"tar -rf SDDbase_LDC.tar %s",filnam);
-       gSystem->Exec(command);
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       if(isFilled[index]){
+         tpan[index]->ValidateAnodes();
+         tpan[index]->WriteToASCII();
+         tpan[index]->WriteToROOT(fh);
+         sprintf(filnam,"SDDbase_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
+         sprintf(command,"tar -rf SDDbase_LDC.tar %s",filnam);
+         gSystem->Exec(command);
+       }
       }
     }  
   }
index 4b3bffc..009d7a0 100644 (file)
@@ -5,7 +5,7 @@
 - DA Type: - LDC
 - Number of events needed: 
 - Input Files: - 
-- Output Files: - SDDinj_mod*_sid*.data
+- Output Files: - SDDinj_ddl*c*_sid*.data
 - Trigger types used: 
 */
 
@@ -77,19 +77,25 @@ int main(int argc, char **argv) {
   Int_t eqOffset = 256;
   Int_t DDLrange = 24;
   Int_t maxNEvents=10; // maximum number of events to be analyzed
-  const Int_t nSDDmodules=12;  // temp for test raw data
-  AliITSOnlineSDDInjectors **injan=new AliITSOnlineSDDInjectors*[2*nSDDmodules];
-  TH2F **histo=new TH2F*[2*nSDDmodules];
-  Int_t nWrittenEv[2*nSDDmodules];
+  const Int_t kTotDDL=24;
+  const Int_t kModPerDDL=12;
+  const Int_t kSides=2;
+  AliITSOnlineSDDInjectors **injan=new AliITSOnlineSDDInjectors*[kTotDDL*kModPerDDL*kSides];
+  TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
+  Int_t nWrittenEv[kTotDDL*kModPerDDL*kSides];
+  Bool_t isFilled[kTotDDL*kModPerDDL*kSides];
 
   Char_t hisnam[20];
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0;isid<2;isid++){
-      Int_t index=2*imod+isid;
-      injan[index]=new AliITSOnlineSDDInjectors(imod,isid);
-      sprintf(hisnam,"his%03ds%d",imod,isid);
-      histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
-      nWrittenEv[index]=0;
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       injan[index]=new AliITSOnlineSDDInjectors(iddl,imod,isid);
+       sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
+       histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
+       nWrittenEv[index]=0;
+       isFilled[index]=0;
+      }
     }
   }
   
@@ -163,36 +169,39 @@ int main(int argc, char **argv) {
        }
 
        rawReader->Reset();
-       for(Int_t imod=0; imod<nSDDmodules;imod++){
-         for(Int_t isid=0; isid<2;isid++){
-           Int_t index=2*imod+isid;
-           histo[index]->Reset();
+       for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+         for(Int_t imod=0; imod<kModPerDDL;imod++){
+           for(Int_t isid=0;isid<kSides;isid++){
+             Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+             histo[index]->Reset();
+           }
          }
        }
        AliITSRawStreamSDD s(rawReader);
        
        while(s.Next()){
-         Int_t iddl=rawReader->GetDDLID();
-         iddl=0; // temporary for test raw data
-         Int_t isddmod=s.GetModuleNumber(iddl,s.GetCarlosId()); 
-         isddmod-=240;  // to have SDD modules from 0 to 259
-         isddmod=s.GetCarlosId(); // temporary for test raw data
-         if(isddmod<nSDDmodules&&s.IsCompletedModule()==kFALSE){ 
-           Int_t index=2*isddmod+s.GetChannel(); 
+         Int_t iDDL=rawReader->GetDDLID();
+         Int_t iCarlos=s.GetCarlosId();
+         if(iDDL>=0 && iDDL<kTotDDL && s.IsCompletedModule()==kFALSE){ 
+           Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel(); 
            histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
+           isFilled[index]=1;
          }
        }
        delete rawReader;
-       for(Int_t imod=0; imod<nSDDmodules;imod++){
-         for(Int_t isid=0; isid<2;isid++){
-           Int_t index=2*imod+isid;
-           injan[index]->Reset();
-           injan[index]->AnalyzeEvent(histo[index]);    
-           injan[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
-           nWrittenEv[index]++;
+       for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+         for(Int_t imod=0; imod<kModPerDDL;imod++){
+           for(Int_t isid=0;isid<kSides;isid++){
+             Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+             if(isFilled[index]){
+               injan[index]->Reset();
+               injan[index]->AnalyzeEvent(histo[index]);    
+               injan[index]->WriteToASCII(iev,timeSt,nWrittenEv[index]);
+               nWrittenEv[index]++;
+             }
+           }
          }
        }
-       
        /* free resources */
        free(event);
       }
@@ -201,12 +210,17 @@ int main(int argc, char **argv) {
   }
     
   Char_t filnam[100],command[120];
-  for(Int_t imod=0; imod<nSDDmodules;imod++){
-    for(Int_t isid=0; isid<2;isid++){
-      sprintf(filnam,"SDDinj_mod%03d_sid%d.data",imod,isid);
-      sprintf(command,"tar -rf SDDinj_LDC1.tar %s",filnam);
-      gSystem->Exec(command);
-    }  
+  for(Int_t iddl=0; iddl<kTotDDL;iddl++){
+    for(Int_t imod=0; imod<kModPerDDL;imod++){
+      for(Int_t isid=0;isid<kSides;isid++){
+       Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+       if(nWrittenEv[index]>0){
+         sprintf(filnam,"SDDinj_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
+         sprintf(command,"tar -rf SDDinj_LDC.tar %s",filnam);
+         gSystem->Exec(command);
+       }
+      }  
+    }
   }
 
   /* write report */
index 943a28c..86bc02d 100644 (file)
@@ -56,6 +56,7 @@
 #pragma link C++ class  AliITSMapSDD+;
 #pragma link C++ class  AliITSDriftSpeedSDD+;
 #pragma link C++ class  AliITSDriftSpeedArraySDD+;
+#pragma link C++ class  AliITSDDLModuleMapSDD+;
 #pragma link C++ class  AliITSBadChannelsSSD+;
 #pragma link C++ class  AliITSGainSSD+;
 #pragma link C++ class  AliITSNoiseSSD+;
index 1b3e038..8d486a3 100644 (file)
 #pragma link C++ class AliITSOnlineSDD+;
 #pragma link C++ class AliITSOnlineSDDBase+;
 #pragma link C++ class AliITSOnlineSDDTP+;
-#pragma link C++ class AliITSOnlineSDDBTP+;
 #pragma link C++ class AliITSOnlineSDDCMN+;
 #pragma link C++ class AliITSOnlineSDDInjectors+;
 #pragma link C++ class AliITSPreprocessorSSD+;
diff --git a/ITS/StoreDDLMapSDD.C b/ITS/StoreDDLMapSDD.C
new file mode 100644 (file)
index 0000000..8809485
--- /dev/null
@@ -0,0 +1,36 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include "AliCDBManager.h"
+#include "AliITSDDLModuleMapSDD.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBStorage.h"
+#include "AliCDBId.h"
+#include "AliCDBPath.h"
+#include "AliCDBEntry.h"
+#include <TObjArray.h>
+#include <TRandom3.h>
+#endif
+
+void StoreDDLMapSDD(Int_t firstRun=0, Int_t lastRun=9999999){
+  ///////////////////////////////////////////////////////////////////////
+  // Macro to generate and store the DDL map for SDD                   //
+  // Generates:                                                        //
+  //  1 file with 1 AliITSDDLModuleMapSDD object (DDLmapSDD)           //
+  ///////////////////////////////////////////////////////////////////////
+  
+  if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
+    AliCDBManager::Instance()->SetDefaultStorage("local://OCDB");
+  }
+  
+
+  AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
+  md1->SetObjectClassName("AliITSDDLModuleMapSDD");
+  md1->SetResponsible("Francesco Prino");
+  md1->SetBeamPeriod(0);
+  md1->SetAliRootVersion("Head 20 dec. 2007"); //root version
+  md1->SetComment("This is a test");
+
+  AliCDBId idDDLSDD("ITS/Calib/DDLMapSDD",firstRun, lastRun);
+  AliITSDDLModuleMapSDD *ddlmap=new AliITSDDLModuleMapSDD();
+  ddlmap->SetDefaultMap();
+  AliCDBManager::Instance()->GetDefaultStorage()->Put(ddlmap, idDDLSDD, md1);  
+}
index 2a0ae60..b89f27d 100644 (file)
@@ -32,6 +32,7 @@ SRCS =        AliITSgeom.cxx \
                AliITSCalibrationSSD.cxx \
                AliITSMapSDD.cxx \
                AliITSDriftSpeedSDD.cxx \
+               AliITSDDLModuleMapSDD.cxx \
                AliITSDriftSpeedArraySDD.cxx \
                AliITSBadChannelsSSD.cxx \
                AliITSGainSSD.cxx \
index 3a52630..02b1c69 100644 (file)
@@ -79,7 +79,6 @@ SRCS =        AliITSDetTypeRec.cxx \
                AliITSOnlineSDD.cxx \
                AliITSOnlineSDDBase.cxx \
                AliITSOnlineSDDTP.cxx \
-               AliITSOnlineSDDBTP.cxx \
                AliITSOnlineSDDInjectors.cxx \
                 AliITSOnlineSDDCMN.cxx \
                AliITSPreprocessorSSD.cxx \