]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSDCSAnalyzerSDD.cxx
set reco param on an event by event basis
[u/mrichter/AliRoot.git] / ITS / AliITSDCSAnalyzerSDD.cxx
index 60995aa907f33ccd93f5f9c941017ceb8192306f..a68a70c4cdb5c43abc055de7f4bd0cf009fd8c4c 100644 (file)
@@ -16,7 +16,6 @@
 /* $Id$ */
 
 ///////////////////////////////////////////////////////////////////
-//                                                               //
 // Implementation of the class for SDD DCS data analysis         //
 // Origin: F.Prino, Torino, prino@to.infn.it                     //
 //         V.Pospisil, CTU Prague, gdermog@seznam.cz             //
@@ -32,50 +31,74 @@ ClassImp(AliITSDCSAnalyzerSDD)
 
 //---------------------------------------------------------------
   AliITSDCSAnalyzerSDD::AliITSDCSAnalyzerSDD(): TObject(),
-fHVDelay(0),fMVDelay(0),fTLDelay(0),fTRDelay(0),fStTLDelay(0),fStTRDelay(0),fOKDelay(0)
-{                       
+fHVDelay(0),fMVDelay(0),fTLDelay(0),fTRDelay(0),fStTLDelay(0),fStTRDelay(0),fOKDelay(0),
+fHVThresholdFrac(0), fMVThresholdFrac(0), fTLThresholdFrac(0), fTRThresholdFrac(0)
+{
 // Default constructor
   Init();
+  SetHVThreshold();
+  SetMVThreshold();
+  SetTLThreshold();
+  SetTRThreshold();
+  for( Int_t moduleLoop = 0; moduleLoop < kNmodules; moduleLoop++ ) fDCSData[moduleLoop] = NULL;
 } /*AliITSDCSAnalyzerSDD::AliITSDCSAnalyzerSDD*/
 
 //---------------------------------------------------------------
 
 AliITSDCSAnalyzerSDD::AliITSDCSAnalyzerSDD(const AliITSDCSAnalyzerSDD& /* dcsa */): TObject(),
-fHVDelay(0),fMVDelay(0),fTLDelay(0),fTRDelay(0),fStTLDelay(0),fStTRDelay(0),fOKDelay(0)
-{                       
-// copy constructor
-                        // Copies are not allowed. The method is protected to avoid misuse.
-  fprintf( stderr, "Copy constructor not allowed");
+fHVDelay(0),fMVDelay(0),fTLDelay(0),fTRDelay(0),fStTLDelay(0),fStTRDelay(0),fOKDelay(0),
+fHVThresholdFrac(0), fMVThresholdFrac(0), fTLThresholdFrac(0), fTRThresholdFrac(0)
+{
+// Copy constructor
+// Copies are not allowed. The method is protected to avoid misuse.
+  AliError("Copy constructor not allowed");
 } /*AliITSDCSAnalyzerSDD::AliITSDCSAnalyzerSDD*/
 
 //---------------------------------------------------------------
 
 AliITSDCSAnalyzerSDD& AliITSDCSAnalyzerSDD::operator=(const AliITSDCSAnalyzerSDD& /* dcsa */)
-{                       
-// assigment operator
-                        // Assignment is not allowed. The method is protected to avoid misuse.
-  fprintf( stderr, "Assignment operator not allowed");
+{
+// Assigment operator
+// Assignment is not allowed. The method is protected to avoid misuse.
+  AliError("Assignment operator not allowed");
   return *this;
 }/*AliITSDCSAnalyzerSDD::operator=*/
 
 //---------------------------------------------------------------
 
 AliITSDCSAnalyzerSDD::~AliITSDCSAnalyzerSDD()
-{                       
-// destructor
+{ 
+// Destructor
   for(int j=0; j<kNmodules; j++)
   {
-    if(fDCSData[j]) delete fDCSData[j];
+    if( fDCSData[j] ) delete fDCSData[j];
   } /*for( j )*/
 } /*AliITSDCSAnalyzerSDD::~AliITSDCSAnalyzerSDD*/
 
 //---------------------------------------------------------------
 
 void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
-{                       
-// Data processing
+{
+// Data processing. Takes DCS points from alias map and sorts them into AliITSDCSDataSDD objects.
+
+   Int_t   counter = 0; // Counter of stored DCS records
+
+   Float_t lastTLValUpper;
+   Float_t lastTLValLower;
+   Float_t lastTRValUpper;
+   Float_t lastTRValLower;
+   Float_t lastHVValUpper;
+   Float_t lastHVValLower;
+   Float_t lastMVValUpper;
+   Float_t lastMVValLower;
+                        // Thresholds for float DCS variables
+
+   Int_t nEntries=0;      // Number of entries in each TObjArray, that contains DCS variable values
+   AliDCSValue *valToProcess;
+                        // Pointer to currently processed DCS variable value
+   Float_t valToProcessFloat;
+                        // Value of currently processed DCS variable
 
-   Int_t counter = 0;
 
    for( Int_t iLay = 3; iLay < 5; iLay++ )
    {
@@ -96,103 +119,137 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
                         // DCS data for specific SDD module will be stored in this class
 
             TObjArray* arrHV = (TObjArray*) dcsMap->GetValue( fHVDPNames[moduleLoop].Data() );
-            if(!arrHV)
-            {
-               fprintf( stderr, Form("DCS HV alias %s not found!\n", fHVDPNames[moduleLoop].Data()));
-               continue;
-            } /*if*/
+            if(!arrHV) AliWarning( Form("DCS HV alias %s not found!\n", fHVDPNames[moduleLoop].Data()) );
 
             TObjArray* arrMV = (TObjArray*) dcsMap->GetValue( fMVDPNames[moduleLoop].Data() );
-            if(!arrMV)
-            {
-               fprintf( stderr, Form("DCS MV alias %s not found!\n", fMVDPNames[moduleLoop].Data()));
-               continue;
-            } /*if*/
+            if(!arrMV) AliWarning( Form("DCS MV alias %s not found!\n", fMVDPNames[moduleLoop].Data()));
 
             TObjArray* arrOK = (TObjArray*) dcsMap->GetValue( fOKDPNames[moduleLoop].Data() );
-            if(!arrOK)
-            {
-               fprintf( stderr, Form("DCS MOD_OK alias %s not found!\n", fOKDPNames[moduleLoop].Data()));
-               continue;
-            } /*if*/
+            if(!arrOK)  AliWarning( Form("DCS MOD_OK alias %s not found!\n", fOKDPNames[moduleLoop].Data()));
 
             TObjArray* arrTL = (TObjArray*) dcsMap->GetValue( fTLDPNames[moduleLoop].Data() );
-            if(!arrTL)
-            {
-               fprintf( stderr, Form("DCS TEMP_L alias %s not found!\n", fTLDPNames[moduleLoop].Data()));
-               continue;
-            } /*if*/
+            if(!arrTL) AliWarning( Form("DCS TEMP_L alias %s not found!\n", fTLDPNames[moduleLoop].Data()));
 
             TObjArray* arrTR = (TObjArray*) dcsMap->GetValue( fTRDPNames[moduleLoop].Data() );
-            if(!arrTR)
-            {
-               fprintf( stderr, Form("DCS TEMP_R alias %s not found!\n", fTRDPNames[moduleLoop].Data()));
-               continue;
-            } /*if*/
+            if(!arrTR) AliWarning( Form("DCS TEMP_R alias %s not found!\n", fTRDPNames[moduleLoop].Data()));
 
             TObjArray* arrStTL = (TObjArray*) dcsMap->GetValue( fTLStDPNames[moduleLoop].Data() );
-            if(!arrStTL)
-            {
-               fprintf( stderr, Form("DCS TEMP_L_STATE alias %s not found!\n", fTLStDPNames[moduleLoop].Data()));
-               continue;
-            } /*if*/
+            if(!arrStTL) AliWarning( Form("DCS TEMP_L_STATE alias %s not found!\n", fTLStDPNames[moduleLoop].Data()));
 
             TObjArray* arrStTR = (TObjArray*) dcsMap->GetValue( fTRStDPNames[moduleLoop].Data() );
-            if(!arrStTR) 
-            {
-               fprintf( stderr, Form("DCS TEMP_R_STATE alias %s not found!\n", fTRStDPNames[moduleLoop].Data()));
-               continue;
-            } /*if*/
+            if(!arrStTR) AliWarning( Form("DCS TEMP_R_STATE alias %s not found!\n", fTRStDPNames[moduleLoop].Data()));
 
+            lastTLValUpper = -1e-10;
+            lastTLValLower = +1e+10;
+            lastTRValUpper = -1e-10;
+            lastTRValLower = +1e+10;
+            lastHVValUpper = -1e-10;
+            lastHVValLower = +1e+10;
+            lastMVValUpper = -1e-10;
+            lastMVValLower = +1e+10;
+                        // First value of any DCS variable must be written
 
-            Int_t nEntries;     
-                        // Number of entries in each TObjArray, that contains DCS variable values
-            AliDCSValue *valToProcess;
-                        // Pointer to currently processed DCS variable value
 
-            nEntries = arrTL->GetEntries();
-            fDCSData[moduleLoop]->SetNPointsTempLeft( nEntries );
+            if( arrTL )
+            {
+               nEntries = arrTL->GetEntries();
+               fDCSData[moduleLoop]->SetNPointsTempLeft( nEntries );
                         // Left temperature array size is set
 
-            for( Int_t tlLoop = 0; tlLoop < nEntries; tlLoop++ )
-            {           // Left temerature values are copied into the AliITSDCSDataSDD TempLeft array
-               valToProcess = (AliDCSValue *)(arrTL->At(tlLoop));
-               fDCSData[moduleLoop]->SetValueTempLeft( valToProcess->GetTimeStamp() - fTLDelay, valToProcess->GetFloat() );
-            } /*for( tlLoop )*/
-            counter += nEntries;
+               for( Int_t tlLoop = 0; tlLoop < nEntries; tlLoop++ )
+               {        // Left temerature values are copied into the AliITSDCSDataSDD TempLeft array
+                  valToProcess = (AliDCSValue *)(arrTL->At(tlLoop));
+                  valToProcessFloat = valToProcess->GetFloat();
+                        // Value is readed from the input array
+
+                  if( lastTLValLower <= valToProcessFloat && valToProcessFloat <= lastTLValUpper ) continue;
+                        // Value did not cross the treshold (upper neither lower),
+                        //  it is not necessary to store it.
+                  fDCSData[moduleLoop]->SetValueTempLeft( valToProcess->GetTimeStamp() - fTLDelay, valToProcessFloat );
+                        // Value is stored
+                  lastTLValLower = valToProcessFloat * ( 1.0 - fTLThresholdFrac );
+                  lastTLValUpper = valToProcessFloat * ( 1.0 + fTLThresholdFrac );
+                        // New tresholds are set
+                  counter ++;
+               } /*for( tlLoop )*/
+            } /*if*/
+
 
-            nEntries = arrTR->GetEntries();
-            fDCSData[moduleLoop]->SetNPointsTempRight( nEntries );
+            if( arrTR )
+            {
+               nEntries = arrTR->GetEntries();
+               fDCSData[moduleLoop]->SetNPointsTempRight( nEntries );
                         // Right temperature array size is set 
 
-            for( Int_t trLoop = 0; trLoop < nEntries; trLoop++ )
-            {           // Right temerature values are copied into the AliITSDCSDataSDD TempRight array
-               valToProcess = (AliDCSValue *)(arrTR->At(trLoop));
-               fDCSData[moduleLoop]->SetValueTempRight( valToProcess->GetTimeStamp() - fTRDelay, valToProcess->GetFloat() );
-            } /*for( trLoop )*/
-            counter += nEntries;
+               for( Int_t trLoop = 0; trLoop < nEntries; trLoop++ )
+               {           // Right temerature values are copied into the AliITSDCSDataSDD TempRight array
+                  valToProcess = (AliDCSValue *)(arrTR->At(trLoop));
+                  valToProcessFloat = valToProcess->GetFloat();
+                         // Value is readed from the input array
+
+                  if( lastTRValLower <= valToProcessFloat && valToProcessFloat <= lastTRValUpper ) continue;
+                         // Value did not cross the treshold (upper neither lower),
+                         //  it is not necessary to store it.
+                  fDCSData[moduleLoop]->SetValueTempRight( valToProcess->GetTimeStamp() - fTRDelay, valToProcessFloat );
+                         // Value is stored
+                  lastTRValLower = valToProcessFloat * ( 1.0 - fTRThresholdFrac );
+                  lastTRValUpper = valToProcessFloat * ( 1.0 + fTRThresholdFrac );
+                         // New tresholds are set
+                  counter ++;
+               } /*for( trLoop )*/
+            } /*if*/
+
 
-            nEntries = arrHV->GetEntries();
-            fDCSData[moduleLoop]->SetNPointsHV( nEntries );
+            if( arrHV )
+            {
+               nEntries = arrHV->GetEntries();
+               fDCSData[moduleLoop]->SetNPointsHV( nEntries );
                         // HV array size is set 
 
-            for( Int_t hvLoop = 0; hvLoop < nEntries; hvLoop++ )
-            {           // HV values are copied into the AliITSDCSDataSDD HV array
-               valToProcess = (AliDCSValue *)(arrHV->At(hvLoop));
-               fDCSData[moduleLoop]->SetValueHV( valToProcess->GetTimeStamp() - fHVDelay, valToProcess->GetFloat() );
-            } /*for( hvLoop )*/
-            counter += nEntries;
+               for( Int_t hvLoop = 0; hvLoop < nEntries; hvLoop++ )
+               {        // HV values are copied into the AliITSDCSDataSDD HV array
+                  valToProcess = (AliDCSValue *)(arrHV->At(hvLoop));
+                  valToProcessFloat = valToProcess->GetFloat();
+                        // Value is readed from the input array
+                  if( lastHVValLower <= valToProcessFloat && valToProcessFloat <= lastHVValUpper ) continue;
+                        // Value did not cross the treshold (upper neither lower),
+                        //  it is not necessary to store it.
+                  fDCSData[moduleLoop]->SetValueHV( valToProcess->GetTimeStamp() - fHVDelay, valToProcessFloat );
+                        // Value is stored
+                  lastHVValLower = valToProcessFloat * ( 1.0 - fHVThresholdFrac );
+                  lastHVValUpper = valToProcessFloat * ( 1.0 + fHVThresholdFrac );
+                        // New tresholds are set
+                  counter ++;
+               } /*for( hvLoop )*/
+
+            } /*if*/
+
 
-            nEntries = arrMV->GetEntries();
-            fDCSData[moduleLoop]->SetNPointsMV( nEntries );
+
+            if( arrMV )
+            {
+               nEntries = arrMV->GetEntries();
+               fDCSData[moduleLoop]->SetNPointsMV( nEntries );
                         // MV array size is set 
 
-            for( Int_t mvLoop = 0; mvLoop < nEntries; mvLoop++ )
-            {           // MV values are copied into the AliITSDCSDataSDD MV array
-               valToProcess = (AliDCSValue *)(arrMV->At(mvLoop));
-               fDCSData[moduleLoop]->SetValueMV( valToProcess->GetTimeStamp() - fMVDelay, valToProcess->GetFloat() );
-            } /*for( mvLoop )*/
-            counter += nEntries;
+               for( Int_t mvLoop = 0; mvLoop < nEntries; mvLoop++ )
+               {        // MV values are copied into the AliITSDCSDataSDD MV array
+                  valToProcess = (AliDCSValue *)(arrMV->At(mvLoop));
+                  valToProcessFloat = valToProcess->GetFloat();
+                        // Value is readed from the input array
+                  if( lastMVValLower <= valToProcessFloat && valToProcessFloat <= lastMVValUpper ) continue;
+                        // Value did not cross the treshold (upper neither lower),
+                        //  it is not necessary to store it.
+                  fDCSData[moduleLoop]->SetValueMV( valToProcess->GetTimeStamp() - fMVDelay, valToProcessFloat );
+                        // Value is stored
+                  lastMVValLower = valToProcessFloat * ( 1.0 - fMVThresholdFrac );
+                  lastMVValUpper = valToProcessFloat * ( 1.0 + fMVThresholdFrac );
+                        // New treshold is ser
+                  counter ++;
+               } /*for( mvLoop )*/
+
+            } /*if*/
+
 
 /* Following part of the code is responsibile for the condensing of all status information given by DCS
    into one array of Char_t. Each record of this array is in principle a bit map : 
@@ -208,9 +265,9 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
    Let's vizualize time stamps of the three input arrays. There is time on x-axis :
 
             +------------+---------------------+------
-            |            |                     |           _OK
-      +------+------+---+--------+------------+------
-      |      |      |            |            |           _TEMP_L_STATE
+            |            |                     |          _OK
+      +-----++------+----+--------+------------+------
+      |      |      |             |            |          _TEMP_L_STATE
    +--+------+---+--+-------+-----+--------+---+------
    |             |          |     |        |   |          _TEMP_R_STATE
    +-------------+----------+-----+--------+---+------
@@ -228,16 +285,35 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
    one (with the time stamp of the earliest one).
 
 */
-
-            Int_t nStTLEntries = arrStTL->GetEntries();
-            Int_t nStTREntries = arrStTR->GetEntries();
-            Int_t nOKEntries = arrOK->GetEntries();
-                        // Gets number of _STAT_L, _STAT_R and _OK values stored in dcsMap
+            Int_t nStTLEntries = 0;
+            Int_t nStTREntries = 0;
+            Int_t nOKEntries = 0;
+
+            bool arrStTLcreated = false;
+            bool arrStTRcreated = false;
+            bool arrOKcreated = false;
+
+            if( arrStTL ) 
+             nStTLEntries = arrStTL->GetEntries();
+            else
+             { arrStTL = new TObjArray; arrStTLcreated = true; }
+
+            if( arrStTR ) 
+             nStTREntries = arrStTR->GetEntries();
+            else
+             { arrStTR = new TObjArray; arrStTRcreated = true; }
+
+            if( arrOK ) 
+             nOKEntries = arrOK->GetEntries();
+            else
+             { arrOK = new TObjArray; arrOKcreated = true; }
+                        // Gets number of _STAT_L, _STAT_R and _OK values stored in dcsMap. If any array does
+                        //  not exist, it must be created (and it will be filled by 0 status later)
 
             if( nStTLEntries < 1 )
             {           // TObjArray arrStTL is empty. This would cause segmentation violation during
                         //  the condensing, so this case must be handled before algorithm starts
-               fprintf( stderr, "%s contains no data!\n", fTLStDPNames[moduleLoop].Data() );
+               AliWarning( Form( "%s contains no data!\n", fTLStDPNames[moduleLoop].Data() ) );
                nStTLEntries = 1;
                arrStTL->Add( new AliDCSValue(  (Int_t)0, 0x7FFFFFFF ) );
                         // 0x7FFFFFFF = 2147483647, maximal signed Int_t number. Left temperature
@@ -247,7 +323,7 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
             if( nStTREntries < 1 )
             {           // TObjArray arrStTR is empty. This would cause segmentation violation during
                         //  the condensing, so this case must be handled before algorithm starts
-               fprintf( stderr, "%s contains no data!\n", fTRStDPNames[moduleLoop].Data() );
+               AliWarning( Form( "%s contains no data!\n", fTRStDPNames[moduleLoop].Data() ) );
                nStTREntries = 1;
                arrStTR->Add( new AliDCSValue(  (Int_t)0, 0x7FFFFFFF ) );
                         // 0x7FFFFFFF = 2147483647, maximal signed Int_t number. Right temperature
@@ -257,7 +333,7 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
             if( nOKEntries < 1 )
             {           // TObjArray arrOK is empty. This would cause segmentation violation during
                         //  the condensing, so this case must be handled before algorithm starts
-               fprintf( stderr, "%s contains no data!\n", fOKDPNames[moduleLoop].Data() );
+               AliWarning( Form( "%s contains no data!\n", fOKDPNames[moduleLoop].Data() ) );
                nOKEntries = 1;
                arrOK->Add( new AliDCSValue(  (Bool_t)0, 0x7FFFFFFF ) );
                         // 0x7FFFFFFF = 2147483647, maximal signed Int_t number.
@@ -279,7 +355,7 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
 
             Int_t idxStTL = 0;
             Int_t idxStTR = 0;
-            Int_t idxOK = 0;    
+            Int_t idxOK = 0;
                         // Input arrays indexes
 
             Int_t tsStTL, tsStTR, tsOK;
@@ -323,15 +399,15 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
 
                bitStatus = 0;
                if( valOK->GetBool() ) bitStatus += 1;        // 0. bit - _OK
-               if( valStTL->GetInt() == 1 ) bitStatus += 2;  // 1. bit - _TEMP_L_STATE
-               if( valStTR->GetInt() == 1 ) bitStatus += 4;  // 2. bit - _TEMP_R_STATE
-                        // Bit map is created
+               if( valStTL->GetInt() == 4 ) bitStatus += 2;  // 1. bit - _TEMP_L_STATE
+               if( valStTR->GetInt() == 4 ) bitStatus += 4;  // 2. bit - _TEMP_R_STATE
+                        // Bit map is created. *TEMP_*_STATE == 4 means "Thermometer is OK"
 
                if( lastBitStatus != bitStatus )
-               {              // If the status bitmap is teh same as last one, it would not be stored.
-                              //  It will save much space.
+               {        // If the status bitmap is the same as last one, it would not be stored.
+                        //  It will save much space.
                   fDCSData[moduleLoop]->SetValueStatus( tsNew, bitStatus );
-                              // Bit map is written into the output array (if different from last value )
+                        // Bit map is written into the output array (if different from last value )
                   lastBitStatus = bitStatus;
                   counter += nEntries;
                } /*if*/
@@ -368,6 +444,12 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
 
             } /*while*/
 
+            fDCSData[moduleLoop]->Compress();
+                        // Size taken by data in AliITSDCSDataSDD object is minimalized
+
+            if( arrStTRcreated ) delete arrStTR;
+            if( arrStTLcreated ) delete arrStTL;
+            if( arrOKcreated ) delete arrOK;
 
           } /*for( iMod )*/
        } /*for( iLad )*/
@@ -382,54 +464,76 @@ void AliITSDCSAnalyzerSDD::AnalyzeData(TMap* dcsMap)
 
 void AliITSDCSAnalyzerSDD::Init()
 {
-  // Initialization of DCS DP names
-  Char_t dpName[50];
-  Char_t modName[50];
-
-
-  for( Int_t iLay = 3; iLay < 5; iLay++ )
-  {
-
-     Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
-     Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
-
-     for(Int_t iLad=0; iLad<maxLad; iLad++)
-     {
-        for(Int_t iMod=0; iMod<maxMod;iMod++)
-        {
-           sprintf(modName,"SDD_LAYER%i_LADDER%02d_MODULE%d", iLay, iLad, iMod);
-           Int_t id = AliITSgeomTGeo::GetModuleIndex( iLay, iLad + 1, iMod + 1 ) - 240;
-
-           sprintf(dpName,"%s_HV",modName);
-           fHVDPNames[id]=dpName;
-           sprintf(dpName,"%s_MV",modName);
-           fMVDPNames[id]=dpName;
-           sprintf(dpName,"%s_OK",modName);
-           fOKDPNames[id]=dpName;
-           sprintf(dpName,"%s_TEMP_L",modName);
-           fTLDPNames[id]=dpName;
-           sprintf(dpName,"%s_TEMP_R",modName);
-           fTRDPNames[id]=dpName;
-           sprintf(dpName,"%s_TEMP_L_STATE",modName);
-           fTLStDPNames[id]=dpName;
-           sprintf(dpName,"%s_TEMP_R_STATE",modName);
-           fTRStDPNames[id]=dpName;
-
-        } /*for( iMod )*/
-     } /*for( iLad )*/
-
+// Initialization of DCS DP names
+  TString modName;
+
+  for( Int_t iLay = 3; iLay < 5; iLay++ ){
+    Int_t maxLad = ( iLay == 3) ? kNladders3 : kNladders4;
+    Int_t maxMod = ( iLay == 3) ? kNmodLad3 : kNmodLad4;
+
+    for(Int_t iLad=0; iLad<maxLad; iLad++){
+      for(Int_t iMod=0; iMod<maxMod;iMod++){
+       modName.Form("SDD_LAYER%i_LADDER%02d_MODULE%d", iLay, iLad, iMod);
+       Int_t id = AliITSgeomTGeo::GetModuleIndex( iLay, iLad + 1, iMod + 1 ) - 240;
+       
+       fHVDPNames[id].Form("%s_HV",modName.Data());
+       fMVDPNames[id].Form("%s_MV",modName.Data());
+       fOKDPNames[id].Form("%s_OK",modName.Data());
+       fTLDPNames[id].Form("%s_TEMP_L",modName.Data());
+       fTRDPNames[id].Form("%s_TEMP_R",modName.Data());
+       fTLStDPNames[id].Form("%s_TEMP_L_STATE",modName.Data());
+       fTRStDPNames[id].Form("%s_TEMP_R_STATE",modName.Data());
+       
+      } /*for( iMod )*/
+    } /*for( iLad )*/
+    
   } /*for( iLay )*/
 
-
+  
 } /*AliITSDCSAnalyzerSDD::Init*/
 
 //---------------------------------------------------------------
 void AliITSDCSAnalyzerSDD::PrintDCSDPNames( FILE *output )
 {
-  // Data processing
+// Prints constructed names of DCS variables into specified file (may be even stdout or stderr)
   for( Int_t j = 0; j < kNmodules; j++ )
   {
     fprintf( output, "Module %d      %s   %s   %s   %s\n",j,fHVDPNames[j].Data(),
                           fMVDPNames[j].Data(),fTLDPNames[j].Data(),fTRDPNames[j].Data());
   } /*for( j )*/
 } /*AliITSDCSAnalyzerSDD::PrintDCSDPNames*/
+
+//---------------------------------------------------------------
+
+void AliITSDCSAnalyzerSDD::Export( char *outputDCSFileName )
+{
+// Exports all stored AliITSDCSDataSDD type object into specified root file. Objects are named as
+//
+// DCSDataSDD_module<number>
+//
+// where <number> is in range 0..256 and it is obtained by calling
+//
+// AliITSgeomTGeo::GetModuleIndex( layer, ladder, moduleInLadder ) - 240
+
+   TFile * newFile = new TFile( outputDCSFileName, "RECREATE" );
+   if( newFile == NULL )
+   {                    // Creates .root file with specified name. if it is not possible,
+                        //  warning is displayed and exporting aborted.
+     AliWarning( Form( "Cannot create %s - export aborted ", outputDCSFileName ) );
+     return;
+   } /*if*/
+
+   newFile->cd();
+
+   char buffer[100];
+
+   for( Int_t moduleLoop = 0; moduleLoop < kNmodules; moduleLoop++ )
+   {                    // loops through all modules and writes appropriate object into the file
+     snprintf( buffer, 99 , "DCSDataSDD_module%i", moduleLoop );
+     if( fDCSData[moduleLoop] ) fDCSData[moduleLoop]->Write( buffer, TObject::kSingleKey );
+   } /*for( moduleLoop )*/
+
+   newFile->Close();
+   delete newFile;
+
+} /*AliITSDCSAnalyzerSDD::Export*/